#include "chrome/browser/ui/views/frame/browser_frame.h"
#include "chrome/browser/ui/views/frame/contents_web_view.h"
#include "chrome/browser/ui/views/frame/immersive_mode_controller.h"
-#include "chrome/browser/ui/views/frame/scroll_end_effect_controller.h"
#include "chrome/browser/ui/views/frame/web_contents_close_handler.h"
#include "chrome/browser/ui/views/load_complete_listener.h"
#include "components/infobars/core/infobar_container.h"
static const char kViewClassName[];
BrowserView();
- virtual ~BrowserView();
+ ~BrowserView() override;
// Takes ownership of |browser|.
void Init(Browser* browser);
void ToolbarSizeChanged(bool is_animating);
// Overridden from BrowserWindow:
- virtual void Show() OVERRIDE;
- virtual void ShowInactive() OVERRIDE;
- virtual void Hide() OVERRIDE;
- virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE;
- virtual void Close() OVERRIDE;
- virtual void Activate() OVERRIDE;
- virtual void Deactivate() OVERRIDE;
- virtual bool IsActive() const OVERRIDE;
- virtual void FlashFrame(bool flash) OVERRIDE;
- virtual bool IsAlwaysOnTop() const OVERRIDE;
- virtual void SetAlwaysOnTop(bool always_on_top) OVERRIDE;
- virtual gfx::NativeWindow GetNativeWindow() OVERRIDE;
- virtual BrowserWindowTesting* GetBrowserWindowTesting() OVERRIDE;
- virtual StatusBubble* GetStatusBubble() OVERRIDE;
- virtual void UpdateTitleBar() OVERRIDE;
- virtual void BookmarkBarStateChanged(
- BookmarkBar::AnimateChangeType change_type) OVERRIDE;
- virtual void UpdateDevTools() OVERRIDE;
- virtual void UpdateLoadingAnimations(bool should_animate) OVERRIDE;
- virtual void SetStarredState(bool is_starred) OVERRIDE;
- virtual void SetTranslateIconToggled(bool is_lit) OVERRIDE;
- virtual void OnActiveTabChanged(content::WebContents* old_contents,
- content::WebContents* new_contents,
- int index,
- int reason) OVERRIDE;
- virtual void ZoomChangedForActiveTab(bool can_show_bubble) OVERRIDE;
- virtual gfx::Rect GetRestoredBounds() const OVERRIDE;
- virtual ui::WindowShowState GetRestoredState() const OVERRIDE;
- virtual gfx::Rect GetBounds() const OVERRIDE;
- virtual bool IsMaximized() const OVERRIDE;
- virtual bool IsMinimized() const OVERRIDE;
- virtual void Maximize() OVERRIDE;
- virtual void Minimize() OVERRIDE;
- virtual void Restore() OVERRIDE;
- virtual void EnterFullscreen(
- const GURL& url, FullscreenExitBubbleType bubble_type) OVERRIDE;
- virtual void ExitFullscreen() OVERRIDE;
- virtual void UpdateFullscreenExitBubbleContent(
+ void Show() override;
+ void ShowInactive() override;
+ void Hide() override;
+ void SetBounds(const gfx::Rect& bounds) override;
+ void Close() override;
+ void Activate() override;
+ void Deactivate() override;
+ bool IsActive() const override;
+ void FlashFrame(bool flash) override;
+ bool IsAlwaysOnTop() const override;
+ void SetAlwaysOnTop(bool always_on_top) override;
+ gfx::NativeWindow GetNativeWindow() const override;
+ BrowserWindowTesting* GetBrowserWindowTesting() override;
+ StatusBubble* GetStatusBubble() override;
+ void UpdateTitleBar() override;
+ void BookmarkBarStateChanged(
+ BookmarkBar::AnimateChangeType change_type) override;
+ void UpdateDevTools() override;
+ void UpdateLoadingAnimations(bool should_animate) override;
+ void SetStarredState(bool is_starred) override;
+ void SetTranslateIconToggled(bool is_lit) override;
+ void OnActiveTabChanged(content::WebContents* old_contents,
+ content::WebContents* new_contents,
+ int index,
+ int reason) override;
+ void ZoomChangedForActiveTab(bool can_show_bubble) override;
+ gfx::Rect GetRestoredBounds() const override;
+ ui::WindowShowState GetRestoredState() const override;
+ gfx::Rect GetBounds() const override;
+ bool IsMaximized() const override;
+ bool IsMinimized() const override;
+ void Maximize() override;
+ void Minimize() override;
+ void Restore() override;
+ void EnterFullscreen(const GURL& url,
+ FullscreenExitBubbleType bubble_type) override;
+ void ExitFullscreen() override;
+ void UpdateFullscreenExitBubbleContent(
const GURL& url,
- FullscreenExitBubbleType bubble_type) OVERRIDE;
- virtual bool ShouldHideUIForFullscreen() const OVERRIDE;
- virtual bool IsFullscreen() const OVERRIDE;
- virtual bool IsFullscreenBubbleVisible() const OVERRIDE;
+ FullscreenExitBubbleType bubble_type) override;
+ bool ShouldHideUIForFullscreen() const override;
+ bool IsFullscreen() const override;
+ bool IsFullscreenBubbleVisible() const override;
#if defined(OS_WIN)
- virtual void SetMetroSnapMode(bool enable) OVERRIDE;
- virtual bool IsInMetroSnapMode() const OVERRIDE;
+ virtual void SetMetroSnapMode(bool enable) override;
+ virtual bool IsInMetroSnapMode() const override;
#endif
- virtual LocationBar* GetLocationBar() const OVERRIDE;
- virtual void SetFocusToLocationBar(bool select_all) OVERRIDE;
- virtual void UpdateReloadStopState(bool is_loading, bool force) OVERRIDE;
- virtual void UpdateToolbar(content::WebContents* contents) OVERRIDE;
- virtual void FocusToolbar() OVERRIDE;
- virtual void FocusAppMenu() OVERRIDE;
- virtual void FocusBookmarksToolbar() OVERRIDE;
- virtual void FocusInfobars() OVERRIDE;
- virtual void RotatePaneFocus(bool forwards) OVERRIDE;
- virtual void DestroyBrowser() OVERRIDE;
- virtual bool IsBookmarkBarVisible() const OVERRIDE;
- virtual bool IsBookmarkBarAnimating() const OVERRIDE;
- virtual bool IsTabStripEditable() const OVERRIDE;
- virtual bool IsToolbarVisible() const OVERRIDE;
- virtual gfx::Rect GetRootWindowResizerRect() const OVERRIDE;
- virtual void ConfirmAddSearchProvider(TemplateURL* template_url,
- Profile* profile) OVERRIDE;
- virtual void ShowUpdateChromeDialog() OVERRIDE;
- virtual void ShowBookmarkBubble(const GURL& url,
- bool already_bookmarked) OVERRIDE;
- virtual void ShowBookmarkAppBubble(
- const WebApplicationInfo& web_app_info,
- const std::string& extension_id) OVERRIDE;
- virtual void ShowTranslateBubble(
- content::WebContents* contents,
- translate::TranslateStep step,
- translate::TranslateErrors::Type error_type,
- bool is_user_gesture) OVERRIDE;
+ LocationBar* GetLocationBar() const override;
+ void SetFocusToLocationBar(bool select_all) override;
+ void UpdateReloadStopState(bool is_loading, bool force) override;
+ void UpdateToolbar(content::WebContents* contents) override;
+ void FocusToolbar() override;
+ void FocusAppMenu() override;
+ void FocusBookmarksToolbar() override;
+ void FocusInfobars() override;
+ void RotatePaneFocus(bool forwards) override;
+ void DestroyBrowser() override;
+ bool IsBookmarkBarVisible() const override;
+ bool IsBookmarkBarAnimating() const override;
+ bool IsTabStripEditable() const override;
+ bool IsToolbarVisible() const override;
+ gfx::Rect GetRootWindowResizerRect() const override;
+ void ConfirmAddSearchProvider(TemplateURL* template_url,
+ Profile* profile) override;
+ void ShowUpdateChromeDialog() override;
+ void ShowBookmarkBubble(const GURL& url, bool already_bookmarked) override;
+ void ShowBookmarkAppBubble(const WebApplicationInfo& web_app_info,
+ const std::string& extension_id) override;
+ void ShowTranslateBubble(content::WebContents* contents,
+ translate::TranslateStep step,
+ translate::TranslateErrors::Type error_type,
+ bool is_user_gesture) override;
#if defined(ENABLE_ONE_CLICK_SIGNIN)
- virtual void ShowOneClickSigninBubble(
+ void ShowOneClickSigninBubble(
OneClickSigninBubbleType type,
const base::string16& email,
const base::string16& error_message,
- const StartSyncCallback& start_sync_callback) OVERRIDE;
+ const StartSyncCallback& start_sync_callback) override;
#endif
// TODO(beng): Not an override, move somewhere else.
void SetDownloadShelfVisible(bool visible);
- virtual bool IsDownloadShelfVisible() const OVERRIDE;
- virtual DownloadShelf* GetDownloadShelf() OVERRIDE;
- virtual void ConfirmBrowserCloseWithPendingDownloads(
+ bool IsDownloadShelfVisible() const override;
+ DownloadShelf* GetDownloadShelf() override;
+ void ConfirmBrowserCloseWithPendingDownloads(
int download_count,
Browser::DownloadClosePreventionType dialog_type,
bool app_modal,
- const base::Callback<void(bool)>& callback) OVERRIDE;
- virtual void UserChangedTheme() OVERRIDE;
- virtual int GetExtraRenderViewHeight() const OVERRIDE;
- virtual void WebContentsFocused(content::WebContents* contents) OVERRIDE;
- virtual void ShowWebsiteSettings(Profile* profile,
- content::WebContents* web_contents,
- const GURL& url,
- const content::SSLStatus& ssl) OVERRIDE;
- virtual void ShowAppMenu() OVERRIDE;
- virtual bool PreHandleKeyboardEvent(
- const content::NativeWebKeyboardEvent& event,
- bool* is_keyboard_shortcut) OVERRIDE;
- virtual void HandleKeyboardEvent(
- const content::NativeWebKeyboardEvent& event) OVERRIDE;
- virtual void Cut() OVERRIDE;
- virtual void Copy() OVERRIDE;
- virtual void Paste() OVERRIDE;
- virtual WindowOpenDisposition GetDispositionForPopupBounds(
- const gfx::Rect& bounds) OVERRIDE;
- virtual FindBar* CreateFindBar() OVERRIDE;
- virtual web_modal::WebContentsModalDialogHost*
- GetWebContentsModalDialogHost() OVERRIDE;
- virtual void ShowAvatarBubble(content::WebContents* web_contents,
- const gfx::Rect& rect) OVERRIDE;
- virtual void ShowAvatarBubbleFromAvatarButton(AvatarBubbleMode mode,
- const signin::ManageAccountsParams& manage_accounts_params) OVERRIDE;
- virtual void OverscrollUpdate(int delta_y) OVERRIDE;
- virtual int GetRenderViewHeightInsetWithDetachedBookmarkBar() OVERRIDE;
- virtual void ExecuteExtensionCommand(
- const extensions::Extension* extension,
- const extensions::Command& command) OVERRIDE;
+ const base::Callback<void(bool)>& callback) override;
+ void UserChangedTheme() override;
+ int GetExtraRenderViewHeight() const override;
+ void WebContentsFocused(content::WebContents* contents) override;
+ void ShowWebsiteSettings(Profile* profile,
+ content::WebContents* web_contents,
+ const GURL& url,
+ const content::SSLStatus& ssl) override;
+ void ShowAppMenu() override;
+ bool PreHandleKeyboardEvent(const content::NativeWebKeyboardEvent& event,
+ bool* is_keyboard_shortcut) override;
+ void HandleKeyboardEvent(
+ const content::NativeWebKeyboardEvent& event) override;
+ void Cut() override;
+ void Copy() override;
+ void Paste() override;
+ WindowOpenDisposition GetDispositionForPopupBounds(
+ const gfx::Rect& bounds) override;
+ FindBar* CreateFindBar() override;
+ web_modal::WebContentsModalDialogHost* GetWebContentsModalDialogHost()
+ override;
+ void ShowAvatarBubble(content::WebContents* web_contents,
+ const gfx::Rect& rect) override;
+ void ShowAvatarBubbleFromAvatarButton(
+ AvatarBubbleMode mode,
+ const signin::ManageAccountsParams& manage_accounts_params) override;
+ int GetRenderViewHeightInsetWithDetachedBookmarkBar() override;
+ void ExecuteExtensionCommand(const extensions::Extension* extension,
+ const extensions::Command& command) override;
// Overridden from BrowserWindowTesting:
- virtual BookmarkBarView* GetBookmarkBarView() const OVERRIDE;
- virtual LocationBarView* GetLocationBarView() const OVERRIDE;
- virtual views::View* GetTabContentsContainerView() const OVERRIDE;
- virtual ToolbarView* GetToolbarView() const OVERRIDE;
+ BookmarkBarView* GetBookmarkBarView() const override;
+ LocationBarView* GetLocationBarView() const override;
+ views::View* GetTabContentsContainerView() const override;
+ ToolbarView* GetToolbarView() const override;
// Overridden from TabStripModelObserver:
- virtual void TabInsertedAt(content::WebContents* contents,
- int index,
- bool foreground) OVERRIDE;
- virtual void TabDetachedAt(content::WebContents* contents,
- int index) OVERRIDE;
- virtual void TabDeactivated(content::WebContents* contents) OVERRIDE;
- virtual void TabStripEmpty() OVERRIDE;
- virtual void WillCloseAllTabs() OVERRIDE;
- virtual void CloseAllTabsCanceled() OVERRIDE;
+ void TabInsertedAt(content::WebContents* contents,
+ int index,
+ bool foreground) override;
+ void TabDetachedAt(content::WebContents* contents, int index) override;
+ void TabDeactivated(content::WebContents* contents) override;
+ void TabStripEmpty() override;
+ void WillCloseAllTabs() override;
+ void CloseAllTabsCanceled() override;
// Overridden from ui::AcceleratorProvider:
- virtual bool GetAcceleratorForCommandId(int command_id,
- ui::Accelerator* accelerator) OVERRIDE;
+ bool GetAcceleratorForCommandId(int command_id,
+ ui::Accelerator* accelerator) override;
// Overridden from views::WidgetDelegate:
- virtual bool CanResize() const OVERRIDE;
- virtual bool CanMaximize() const OVERRIDE;
- virtual bool CanMinimize() const OVERRIDE;
- virtual bool CanActivate() const OVERRIDE;
- virtual base::string16 GetWindowTitle() const OVERRIDE;
- virtual base::string16 GetAccessibleWindowTitle() const OVERRIDE;
- virtual views::View* GetInitiallyFocusedView() OVERRIDE;
- virtual bool ShouldShowWindowTitle() const OVERRIDE;
- virtual gfx::ImageSkia GetWindowAppIcon() OVERRIDE;
- virtual gfx::ImageSkia GetWindowIcon() OVERRIDE;
- virtual bool ShouldShowWindowIcon() const OVERRIDE;
- virtual bool ExecuteWindowsCommand(int command_id) OVERRIDE;
- virtual std::string GetWindowName() const OVERRIDE;
- virtual void SaveWindowPlacement(const gfx::Rect& bounds,
- ui::WindowShowState show_state) OVERRIDE;
- virtual bool GetSavedWindowPlacement(
- const views::Widget* widget,
- gfx::Rect* bounds,
- ui::WindowShowState* show_state) const OVERRIDE;
- virtual views::View* GetContentsView() OVERRIDE;
- virtual views::ClientView* CreateClientView(views::Widget* widget) OVERRIDE;
- virtual void OnWindowBeginUserBoundsChange() OVERRIDE;
- virtual void OnWidgetMove() OVERRIDE;
- virtual views::Widget* GetWidget() OVERRIDE;
- virtual const views::Widget* GetWidget() const OVERRIDE;
- virtual void GetAccessiblePanes(std::vector<View*>* panes) OVERRIDE;
+ bool CanResize() const override;
+ bool CanMaximize() const override;
+ bool CanMinimize() const override;
+ bool CanActivate() const override;
+ base::string16 GetWindowTitle() const override;
+ base::string16 GetAccessibleWindowTitle() const override;
+ views::View* GetInitiallyFocusedView() override;
+ bool ShouldShowWindowTitle() const override;
+ gfx::ImageSkia GetWindowAppIcon() override;
+ gfx::ImageSkia GetWindowIcon() override;
+ bool ShouldShowWindowIcon() const override;
+ bool ExecuteWindowsCommand(int command_id) override;
+ std::string GetWindowName() const override;
+ void SaveWindowPlacement(const gfx::Rect& bounds,
+ ui::WindowShowState show_state) override;
+ bool GetSavedWindowPlacement(const views::Widget* widget,
+ gfx::Rect* bounds,
+ ui::WindowShowState* show_state) const override;
+ views::View* GetContentsView() override;
+ views::ClientView* CreateClientView(views::Widget* widget) override;
+ void OnWindowBeginUserBoundsChange() override;
+ void OnWidgetMove() override;
+ views::Widget* GetWidget() override;
+ const views::Widget* GetWidget() const override;
+ void GetAccessiblePanes(std::vector<View*>* panes) override;
// Overridden from views::WidgetObserver:
- virtual void OnWidgetActivationChanged(views::Widget* widget,
- bool active) OVERRIDE;
+ void OnWidgetActivationChanged(views::Widget* widget, bool active) override;
// Overridden from views::ClientView:
- virtual bool CanClose() OVERRIDE;
- virtual int NonClientHitTest(const gfx::Point& point) OVERRIDE;
- virtual gfx::Size GetMinimumSize() const OVERRIDE;
+ bool CanClose() override;
+ int NonClientHitTest(const gfx::Point& point) override;
+ gfx::Size GetMinimumSize() const override;
// InfoBarContainer::Delegate overrides
- virtual SkColor GetInfoBarSeparatorColor() const OVERRIDE;
- virtual void InfoBarContainerStateChanged(bool is_animating) OVERRIDE;
- virtual bool DrawInfoBarArrows(int* x) const OVERRIDE;
+ SkColor GetInfoBarSeparatorColor() const override;
+ void InfoBarContainerStateChanged(bool is_animating) override;
+ bool DrawInfoBarArrows(int* x) const override;
// Overridden from views::View:
- virtual const char* GetClassName() const OVERRIDE;
- virtual void Layout() OVERRIDE;
- virtual void PaintChildren(gfx::Canvas* canvas,
- const views::CullSet& cull_set) OVERRIDE;
- virtual void ViewHierarchyChanged(
- const ViewHierarchyChangedDetails& details) OVERRIDE;
- virtual void ChildPreferredSizeChanged(View* child) OVERRIDE;
- virtual void GetAccessibleState(ui::AXViewState* state) OVERRIDE;
- virtual void OnNativeThemeChanged(const ui::NativeTheme* theme) OVERRIDE;
+ const char* GetClassName() const override;
+ void Layout() override;
+ void PaintChildren(gfx::Canvas* canvas,
+ const views::CullSet& cull_set) override;
+ void ViewHierarchyChanged(
+ const ViewHierarchyChangedDetails& details) override;
+ void ChildPreferredSizeChanged(View* child) override;
+ void GetAccessibleState(ui::AXViewState* state) override;
+ void OnNativeThemeChanged(const ui::NativeTheme* theme) override;
// Overridden from ui::AcceleratorTarget:
- virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) OVERRIDE;
+ bool AcceleratorPressed(const ui::Accelerator& accelerator) override;
// OmniboxPopupModelObserver overrides
- virtual void OnOmniboxPopupShownOrHidden() OVERRIDE;
+ void OnOmniboxPopupShownOrHidden() override;
// Testing interface:
views::View* GetContentsContainerForTest() { return contents_container_; }
// LoadCompleteListener::Delegate implementation. Creates and initializes the
// |jumplist_| after the first page load.
- virtual void OnLoadCompleted() OVERRIDE;
+ void OnLoadCompleted() override;
// Returns the BrowserViewLayout.
BrowserViewLayout* GetBrowserViewLayout() const;
scoped_ptr<ImmersiveModeController> immersive_mode_controller_;
- scoped_ptr<ScrollEndEffectController> scroll_end_effect_controller_;
-
scoped_ptr<WebContentsCloseHandler> web_contents_close_handler_;
mutable base::WeakPtrFactory<BrowserView> activate_modal_dialog_factory_;