Skip to content

Commit

Permalink
Standardize usage of virtual/override/final specifiers.
Browse files Browse the repository at this point in the history
The Google C++ style guide states:

  Explicitly annotate overrides of virtual functions or virtual
  destructors with an override or (less frequently) final specifier.
  Older (pre-C++11) code will use the virtual keyword as an inferior
  alternative annotation. For clarity, use exactly one of override,
  final, or virtual when declaring an override.

To better conform to these guidelines, the following constructs have
been rewritten:

- if a base class has a virtual destructor, then:
    virtual ~Foo();                   ->  ~Foo() override;
- virtual void Foo() override;        ->  void Foo() override;
- virtual void Foo() override final;  ->  void Foo() final;

This patch was automatically generated. The clang plugin can generate
fixit hints, which are suggested edits when it is 100% sure it knows how
to fix a problem. The hints from the clang plugin were applied to the
source tree using the tool in https://codereview.chromium.org/598073004.

BUG=417463
R=jamescook@chromium.org

Review URL: https://codereview.chromium.org/679283002

Cr-Commit-Position: refs/heads/master@{#301535}
  • Loading branch information
zetafunction authored and Commit bot committed Oct 28, 2014
1 parent fa85b15 commit f596351
Show file tree
Hide file tree
Showing 20 changed files with 217 additions and 266 deletions.
82 changes: 31 additions & 51 deletions ash/shell/app_list.cc
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,7 @@ class WindowTypeShelfItem : public app_list::AppListItem {
}

// AppListItem
virtual void Activate(int event_flags) override {
ActivateItem(type_, event_flags);
}
void Activate(int event_flags) override { ActivateItem(type_, event_flags); }

private:
Type type_;
Expand Down Expand Up @@ -189,7 +187,7 @@ class ExampleSearchResult : public app_list::SearchResult {
WindowTypeShelfItem::Type type() const { return type_; }

// app_list::SearchResult:
virtual scoped_ptr<SearchResult> Duplicate() override {
scoped_ptr<SearchResult> Duplicate() override {
return scoped_ptr<SearchResult>();
}

Expand Down Expand Up @@ -240,56 +238,45 @@ class ExampleAppListViewDelegate : public app_list::AppListViewDelegate {
}

// Overridden from app_list::AppListViewDelegate:
virtual bool ForceNativeDesktop() const override {
return false;
}
bool ForceNativeDesktop() const override { return false; }

virtual void SetProfileByPath(const base::FilePath& profile_path) override {
void SetProfileByPath(const base::FilePath& profile_path) override {
// Nothing needs to be done.
}

virtual const Users& GetUsers() const override {
return users_;
}
const Users& GetUsers() const override { return users_; }

virtual bool ShouldCenterWindow() const override {
return false;
}
bool ShouldCenterWindow() const override { return false; }

virtual app_list::AppListModel* GetModel() override { return model_.get(); }
app_list::AppListModel* GetModel() override { return model_.get(); }

virtual app_list::SpeechUIModel* GetSpeechUI() override {
return &speech_ui_;
}
app_list::SpeechUIModel* GetSpeechUI() override { return &speech_ui_; }

virtual void GetShortcutPathForApp(
void GetShortcutPathForApp(
const std::string& app_id,
const base::Callback<void(const base::FilePath&)>& callback) override {
callback.Run(base::FilePath());
}

virtual void OpenSearchResult(app_list::SearchResult* result,
bool auto_launch,
int event_flags) override {
void OpenSearchResult(app_list::SearchResult* result,
bool auto_launch,
int event_flags) override {
const ExampleSearchResult* example_result =
static_cast<const ExampleSearchResult*>(result);
WindowTypeShelfItem::ActivateItem(example_result->type(), event_flags);
}

virtual void InvokeSearchResultAction(app_list::SearchResult* result,
int action_index,
int event_flags) override {
void InvokeSearchResultAction(app_list::SearchResult* result,
int action_index,
int event_flags) override {
NOTIMPLEMENTED();
}

virtual base::TimeDelta GetAutoLaunchTimeout() override {
return base::TimeDelta();
}
base::TimeDelta GetAutoLaunchTimeout() override { return base::TimeDelta(); }

virtual void AutoLaunchCanceled() override {
}
void AutoLaunchCanceled() override {}

virtual void StartSearch() override {
void StartSearch() override {
base::string16 query;
base::TrimWhitespace(model_->search_box()->text(), base::TRIM_ALL, &query);
query = base::i18n::ToLower(query);
Expand All @@ -311,60 +298,53 @@ class ExampleAppListViewDelegate : public app_list::AppListViewDelegate {
}
}

virtual void StopSearch() override {
void StopSearch() override {
// Nothing needs to be done.
}

virtual void ViewInitialized() override {
void ViewInitialized() override {
// Nothing needs to be done.
}

virtual void Dismiss() override {
void Dismiss() override {
DCHECK(ash::Shell::HasInstance());
Shell::GetInstance()->DismissAppList();
}

virtual void ViewClosing() override {
void ViewClosing() override {
// Nothing needs to be done.
}

virtual gfx::ImageSkia GetWindowIcon() override {
return gfx::ImageSkia();
}
gfx::ImageSkia GetWindowIcon() override { return gfx::ImageSkia(); }

virtual void OpenSettings() override {
void OpenSettings() override {
// Nothing needs to be done.
}

virtual void OpenHelp() override {
void OpenHelp() override {
// Nothing needs to be done.
}

virtual void OpenFeedback() override {
void OpenFeedback() override {
// Nothing needs to be done.
}

virtual void ToggleSpeechRecognition() override {
NOTIMPLEMENTED();
}
void ToggleSpeechRecognition() override { NOTIMPLEMENTED(); }

virtual void ShowForProfileByPath(
const base::FilePath& profile_path) override {
void ShowForProfileByPath(const base::FilePath& profile_path) override {
// Nothing needs to be done.
}

virtual views::View* CreateStartPageWebView(const gfx::Size& size) override {
views::View* CreateStartPageWebView(const gfx::Size& size) override {
return NULL;
}

virtual std::vector<views::View*> CreateCustomPageWebViews(
std::vector<views::View*> CreateCustomPageWebViews(
const gfx::Size& size) override {
return std::vector<views::View*>();
}

virtual bool IsSpeechRecognitionEnabled() override {
return false;
}
bool IsSpeechRecognitionEnabled() override { return false; }

scoped_ptr<app_list::AppListModel> model_;
app_list::SpeechUIModel speech_ui_;
Expand Down
2 changes: 1 addition & 1 deletion ash/shell/bubble.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class ExampleBubbleDelegateView : public views::BubbleDelegateView {
: BubbleDelegateView(config.anchor_view, config.arrow),
label_(config.label) {}

virtual void Init() override {
void Init() override {
SetLayoutManager(new views::FillLayout());
views::Label* label = new views::Label(label_);
AddChildView(label);
Expand Down
6 changes: 3 additions & 3 deletions ash/shell/content_client/shell_browser_main_parts.cc
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,14 @@ namespace {
class ShellViewsDelegate : public views::TestViewsDelegate {
public:
ShellViewsDelegate() {}
virtual ~ShellViewsDelegate() {}
~ShellViewsDelegate() override {}

// Overridden from views::TestViewsDelegate:
virtual views::NonClientFrameView* CreateDefaultNonClientFrameView(
views::NonClientFrameView* CreateDefaultNonClientFrameView(
views::Widget* widget) override {
return ash::Shell::GetInstance()->CreateDefaultNonClientFrameView(widget);
}
virtual void OnBeforeWidgetInit(
void OnBeforeWidgetInit(
views::Widget::InitParams* params,
views::internal::NativeWidgetDelegate* delegate) override {
if (params->opacity == views::Widget::InitParams::INFER_OPACITY)
Expand Down
14 changes: 7 additions & 7 deletions ash/shell/content_client/shell_browser_main_parts.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@ class ShellBrowserMainParts : public content::BrowserMainParts {
public:
explicit ShellBrowserMainParts(
const content::MainFunctionParams& parameters);
virtual ~ShellBrowserMainParts();
~ShellBrowserMainParts() override;

// Overridden from content::BrowserMainParts:
virtual void PreMainMessageLoopStart() override;
virtual void PostMainMessageLoopStart() override;
virtual void ToolkitInitialized() override;
virtual void PreMainMessageLoopRun() override;
virtual bool MainMessageLoopRun(int* result_code) override;
virtual void PostMainMessageLoopRun() override;
void PreMainMessageLoopStart() override;
void PostMainMessageLoopStart() override;
void ToolkitInitialized() override;
void PreMainMessageLoopRun() override;
bool MainMessageLoopRun(int* result_code) override;
void PostMainMessageLoopRun() override;

content::ShellBrowserContext* browser_context() {
return browser_context_.get();
Expand Down
6 changes: 3 additions & 3 deletions ash/shell/content_client/shell_content_browser_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ class ShellBrowserMainParts;
class ShellContentBrowserClient : public content::ContentBrowserClient {
public:
ShellContentBrowserClient();
virtual ~ShellContentBrowserClient();
~ShellContentBrowserClient() override;

// Overridden from content::ContentBrowserClient:
virtual content::BrowserMainParts* CreateBrowserMainParts(
content::BrowserMainParts* CreateBrowserMainParts(
const content::MainFunctionParams& parameters) override;
virtual net::URLRequestContextGetter* CreateRequestContext(
net::URLRequestContextGetter* CreateRequestContext(
content::BrowserContext* browser_context,
content::ProtocolHandlerMap* protocol_handlers,
content::URLRequestInterceptorScopedVector request_interceptors) override;
Expand Down
8 changes: 4 additions & 4 deletions ash/shell/content_client/shell_main_delegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ class ShellContentBrowserClient;
class ShellMainDelegate : public content::ContentMainDelegate {
public:
ShellMainDelegate();
virtual ~ShellMainDelegate();
~ShellMainDelegate() override;

virtual bool BasicStartupComplete(int* exit_code) override;
virtual void PreSandboxStartup() override;
virtual content::ContentBrowserClient* CreateContentBrowserClient() override;
bool BasicStartupComplete(int* exit_code) override;
void PreSandboxStartup() override;
content::ContentBrowserClient* CreateContentBrowserClient() override;

private:
void InitializeResourceBundle();
Expand Down
13 changes: 6 additions & 7 deletions ash/shell/context_menu.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,14 @@ class ContextMenu : public ui::SimpleMenuModel,
public ui::SimpleMenuModel::Delegate {
public:
explicit ContextMenu(aura::Window* root);
virtual ~ContextMenu();
~ContextMenu() override;

// ui::SimpleMenuModel::Delegate overrides:
virtual bool IsCommandIdChecked(int command_id) const override;
virtual bool IsCommandIdEnabled(int command_id) const override;
virtual bool GetAcceleratorForCommandId(
int command_id,
ui::Accelerator* accelerator) override;
virtual void ExecuteCommand(int command_id, int event_flags) override;
bool IsCommandIdChecked(int command_id) const override;
bool IsCommandIdEnabled(int command_id) const override;
bool GetAcceleratorForCommandId(int command_id,
ui::Accelerator* accelerator) override;
void ExecuteCommand(int command_id, int event_flags) override;

private:
enum MenuItem {
Expand Down
17 changes: 9 additions & 8 deletions ash/shell/keyboard_controller_proxy_stub.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,21 @@ namespace ash {
class KeyboardControllerProxyStub : public keyboard::KeyboardControllerProxy {
public:
KeyboardControllerProxyStub();
virtual ~KeyboardControllerProxyStub();
~KeyboardControllerProxyStub() override;

virtual bool HasKeyboardWindow() const override;
virtual aura::Window* GetKeyboardWindow() override;
bool HasKeyboardWindow() const override;
aura::Window* GetKeyboardWindow() override;

private:
// Overridden from keyboard::KeyboardControllerProxy:
virtual content::BrowserContext* GetBrowserContext() override;
virtual ui::InputMethod* GetInputMethod() override;
virtual void RequestAudioInput(content::WebContents* web_contents,
content::BrowserContext* GetBrowserContext() override;
ui::InputMethod* GetInputMethod() override;
void RequestAudioInput(
content::WebContents* web_contents,
const content::MediaStreamRequest& request,
const content::MediaResponseCallback& callback) override;
virtual void LoadSystemKeyboard() override;
virtual void ReloadKeyboardIfNeeded() override;
void LoadSystemKeyboard() override;
void ReloadKeyboardIfNeeded() override;

aura::test::TestWindowDelegate delegate_;
scoped_ptr<aura::Window> keyboard_;
Expand Down
17 changes: 7 additions & 10 deletions ash/shell/lock_view.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,14 @@ class LockView : public views::WidgetDelegateView,
AddChildView(unlock_button_);
unlock_button_->SetFocusable(true);
}
virtual ~LockView() {}
~LockView() override {}

// Overridden from views::View:
virtual gfx::Size GetPreferredSize() const override {
return gfx::Size(500, 400);
}
gfx::Size GetPreferredSize() const override { return gfx::Size(500, 400); }

private:
// Overridden from views::View:
virtual void OnPaint(gfx::Canvas* canvas) override {
void OnPaint(gfx::Canvas* canvas) override {
canvas->FillRect(GetLocalBounds(), SK_ColorYELLOW);
base::string16 text = base::ASCIIToUTF16("LOCKED!");
int string_width = gfx::GetStringWidth(text, font_list_);
Expand All @@ -50,28 +48,27 @@ class LockView : public views::WidgetDelegateView,
(height() - font_list_.GetHeight()) / 2,
string_width, font_list_.GetHeight()));
}
virtual void Layout() override {
void Layout() override {
gfx::Rect bounds = GetLocalBounds();
gfx::Size ps = unlock_button_->GetPreferredSize();
bounds.set_y(bounds.bottom() - ps.height() - 5);
bounds.set_x((bounds.width() - ps.width()) / 2);
bounds.set_size(ps);
unlock_button_->SetBoundsRect(bounds);
}
virtual void ViewHierarchyChanged(
void ViewHierarchyChanged(
const ViewHierarchyChangedDetails& details) override {
if (details.is_add && details.child == this)
unlock_button_->RequestFocus();
}

// Overridden from views::WidgetDelegateView:
virtual void WindowClosing() override {
void WindowClosing() override {
Shell::GetInstance()->session_state_delegate()->UnlockScreen();
}

// Overridden from views::ButtonListener:
virtual void ButtonPressed(views::Button* sender,
const ui::Event& event) override {
void ButtonPressed(views::Button* sender, const ui::Event& event) override {
DCHECK(sender == unlock_button_);
GetWidget()->Close();
}
Expand Down
18 changes: 9 additions & 9 deletions ash/shell/panel_window.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class PanelFrameView;
class PanelWindow : public views::WidgetDelegateView {
public:
explicit PanelWindow(const std::string& name);
virtual ~PanelWindow();
~PanelWindow() override;

// Creates the widget for the panel window using |params_|.
views::Widget* CreateWidget();
Expand All @@ -33,16 +33,16 @@ class PanelWindow : public views::WidgetDelegateView {

private:
// Overridden from views::View:
virtual gfx::Size GetPreferredSize() const override;
virtual void OnPaint(gfx::Canvas* canvas) override;
gfx::Size GetPreferredSize() const override;
void OnPaint(gfx::Canvas* canvas) override;

// Overridden from views::WidgetDelegate:
virtual base::string16 GetWindowTitle() const override;
virtual View* GetContentsView() override;
virtual bool CanResize() const override;
virtual bool CanMaximize() const override;
virtual bool CanMinimize() const override;
virtual views::NonClientFrameView* CreateNonClientFrameView(
base::string16 GetWindowTitle() const override;
View* GetContentsView() override;
bool CanResize() const override;
bool CanMaximize() const override;
bool CanMinimize() const override;
views::NonClientFrameView* CreateNonClientFrameView(
views::Widget* widget) override;

std::string name_;
Expand Down
Loading

0 comments on commit f596351

Please sign in to comment.