diff options
author | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-04 23:15:53 +0000 |
---|---|---|
committer | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-04 23:15:53 +0000 |
commit | 164606478faaa606df0c3d2637c4c0a476a59414 (patch) | |
tree | 2fd9491713efb56e15883848237f83c119c68a69 /chrome/browser/ui | |
parent | 039c7b0b28a2501bf4f305ec9e21dbb7518e52cc (diff) | |
download | chromium_src-164606478faaa606df0c3d2637c4c0a476a59414.zip chromium_src-164606478faaa606df0c3d2637c4c0a476a59414.tar.gz chromium_src-164606478faaa606df0c3d2637c4c0a476a59414.tar.bz2 |
Do all OOLing in the views code. linux_views now builds clean with the clang plugin.
BUG=carnitas
TEST=compiles
Review URL: http://codereview.chromium.org/6622002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@76992 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/ui')
43 files changed, 211 insertions, 96 deletions
diff --git a/chrome/browser/ui/views/accessible_pane_view.cc b/chrome/browser/ui/views/accessible_pane_view.cc index c6789bc..94782c7 100644 --- a/chrome/browser/ui/views/accessible_pane_view.cc +++ b/chrome/browser/ui/views/accessible_pane_view.cc @@ -87,6 +87,10 @@ bool AccessiblePaneView::SetPaneFocusAndFocusDefault( return SetPaneFocus(view_storage_id, GetDefaultFocusableChild()); } +views::View* AccessiblePaneView::GetDefaultFocusableChild() { + return NULL; +} + void AccessiblePaneView::RemovePaneFocus() { focus_manager_->RemoveFocusChangeListener(this); pane_has_focus_ = false; diff --git a/chrome/browser/ui/views/accessible_pane_view.h b/chrome/browser/ui/views/accessible_pane_view.h index 349fc0d..be08980 100644 --- a/chrome/browser/ui/views/accessible_pane_view.h +++ b/chrome/browser/ui/views/accessible_pane_view.h @@ -58,7 +58,7 @@ class AccessiblePaneView : public views::View, protected: // A subclass can override this to provide a default focusable child // other than the first focusable child. - virtual views::View* GetDefaultFocusableChild() { return NULL; } + virtual views::View* GetDefaultFocusableChild(); // Remove pane focus. virtual void RemovePaneFocus(); diff --git a/chrome/browser/ui/views/autocomplete/autocomplete_result_view.cc b/chrome/browser/ui/views/autocomplete/autocomplete_result_view.cc index eaf858a..613c6a2 100644 --- a/chrome/browser/ui/views/autocomplete/autocomplete_result_view.cc +++ b/chrome/browser/ui/views/autocomplete/autocomplete_result_view.cc @@ -34,6 +34,28 @@ const int kMinimumTextVerticalPadding = 3; //////////////////////////////////////////////////////////////////////////////// // AutocompleteResultView, public: +// Precalculated data used to draw the portion of a match classification that +// fits entirely within one run. +struct AutocompleteResultView::ClassificationData { + string16 text; + const gfx::Font* font; + SkColor color; + int pixel_width; +}; + +// Precalculated data used to draw a complete visual run within the match. +// This will include all or part of at leasdt one, and possibly several, +// classifications. +struct AutocompleteResultView::RunData { + size_t run_start; // Offset within the match text where this run begins. + int visual_order; // Where this run occurs in visual order. The earliest + // run drawn is run 0. + bool is_rtl; + int pixel_width; + Classifications classifications; // Classification pieces within this run, + // in logical order. +}; + // This class is a utility class for calculations affected by whether the result // view is horizontally mirrored. The drawing functions can be written as if // all drawing occurs left-to-right, and then use this class to get the actual diff --git a/chrome/browser/ui/views/autocomplete/autocomplete_result_view.h b/chrome/browser/ui/views/autocomplete/autocomplete_result_view.h index a8e7673..1fba8a5 100644 --- a/chrome/browser/ui/views/autocomplete/autocomplete_result_view.h +++ b/chrome/browser/ui/views/autocomplete/autocomplete_result_view.h @@ -80,28 +80,10 @@ class AutocompleteResultView : public views::View { int text_vertical_padding_; private: - // Precalculated data used to draw the portion of a match classification that - // fits entirely within one run. - struct ClassificationData { - string16 text; - const gfx::Font* font; - SkColor color; - int pixel_width; - }; + struct ClassificationData; typedef std::vector<ClassificationData> Classifications; - // Precalculated data used to draw a complete visual run within the match. - // This will include all or part of at leasdt one, and possibly several, - // classifications. - struct RunData { - size_t run_start; // Offset within the match text where this run begins. - int visual_order; // Where this run occurs in visual order. The earliest - // run drawn is run 0. - bool is_rtl; - int pixel_width; - Classifications classifications; // Classification pieces within this run, - // in logical order. - }; + struct RunData; typedef std::vector<RunData> Runs; // Predicate functions for use when sorting the runs. diff --git a/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc b/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc index 149681d..cf2cb2a 100644 --- a/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc +++ b/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc @@ -716,6 +716,10 @@ double BookmarkBarView::GetAnimationValue() const { return size_animation_->GetCurrentValue(); } +int BookmarkBarView::GetToolbarOverlap() const { + return GetToolbarOverlap(false); +} + bool BookmarkBarView::IsAlwaysShown() const { return profile_->GetPrefs()->GetBoolean(prefs::kShowBookmarkBar); } diff --git a/chrome/browser/ui/views/bookmarks/bookmark_bar_view.h b/chrome/browser/ui/views/bookmarks/bookmark_bar_view.h index 8b88a28cb..b447606 100644 --- a/chrome/browser/ui/views/bookmarks/bookmark_bar_view.h +++ b/chrome/browser/ui/views/bookmarks/bookmark_bar_view.h @@ -114,9 +114,7 @@ class BookmarkBarView : public DetachableToolbarView, virtual bool IsDetached() const; virtual bool IsOnTop() const; virtual double GetAnimationValue() const; - virtual int GetToolbarOverlap() const { - return GetToolbarOverlap(false); - } + virtual int GetToolbarOverlap() const; // View methods: virtual gfx::Size GetPreferredSize(); @@ -182,8 +180,8 @@ class BookmarkBarView : public DetachableToolbarView, bool is_animating(); // SlideAnimationDelegate implementation. - void AnimationProgressed(const ui::Animation* animation); - void AnimationEnded(const ui::Animation* animation); + virtual void AnimationProgressed(const ui::Animation* animation); + virtual void AnimationEnded(const ui::Animation* animation); // BookmarkMenuController::Observer virtual void BookmarkMenuDeleted(BookmarkMenuController* controller); diff --git a/chrome/browser/ui/views/bookmarks/bookmark_bubble_view.cc b/chrome/browser/ui/views/bookmarks/bookmark_bubble_view.cc index 9c2ca9e..cd6fea2 100644 --- a/chrome/browser/ui/views/bookmarks/bookmark_bubble_view.cc +++ b/chrome/browser/ui/views/bookmarks/bookmark_bubble_view.cc @@ -333,6 +333,10 @@ bool BookmarkBubbleView::CloseOnEscape() { return delegate_ ? delegate_->CloseOnEscape() : true; } +bool BookmarkBubbleView::FadeInOnShow() { + return false; +} + std::wstring BookmarkBubbleView::accessible_name() { return UTF16ToWide( l10n_util::GetStringUTF16(IDS_BOOMARK_BUBBLE_ADD_BOOKMARK)); diff --git a/chrome/browser/ui/views/bookmarks/bookmark_bubble_view.h b/chrome/browser/ui/views/bookmarks/bookmark_bubble_view.h index c691c79..173e97f 100644 --- a/chrome/browser/ui/views/bookmarks/bookmark_bubble_view.h +++ b/chrome/browser/ui/views/bookmarks/bookmark_bubble_view.h @@ -91,7 +91,7 @@ class BookmarkBubbleView : public views::View, virtual void InfoBubbleClosing(InfoBubble* info_bubble, bool closed_by_escape); virtual bool CloseOnEscape(); - virtual bool FadeInOnShow() { return false; } + virtual bool FadeInOnShow(); virtual std::wstring accessible_name(); // Closes the bubble. diff --git a/chrome/browser/ui/views/clear_browsing_data.cc b/chrome/browser/ui/views/clear_browsing_data.cc index ca85a4fc..36119d0 100644 --- a/chrome/browser/ui/views/clear_browsing_data.cc +++ b/chrome/browser/ui/views/clear_browsing_data.cc @@ -358,6 +358,14 @@ views::ClientView* ClearBrowsingDataView::CreateClientView( return client_view; } +views::View* ClearBrowsingDataView::GetExtraView() { + return throbber_view_; +} + +bool ClearBrowsingDataView::GetSizeExtraViewHeightToButtons() { + return true; +} + //////////////////////////////////////////////////////////////////////////////// // ClearBrowsingDataView, ComboboxModel implementation: diff --git a/chrome/browser/ui/views/clear_browsing_data.h b/chrome/browser/ui/views/clear_browsing_data.h index b7e2ce9..ed853df1 100644 --- a/chrome/browser/ui/views/clear_browsing_data.h +++ b/chrome/browser/ui/views/clear_browsing_data.h @@ -64,9 +64,9 @@ class ClearBrowsingDataView : public views::View, virtual std::wstring GetWindowTitle() const; virtual bool Accept(); virtual views::View* GetContentsView(); - views::ClientView* CreateClientView(views::Window* window); - virtual views::View* GetExtraView() { return throbber_view_; } - virtual bool GetSizeExtraViewHeightToButtons() { return true; } + virtual views::ClientView* CreateClientView(views::Window* window); + virtual views::View* GetExtraView(); + virtual bool GetSizeExtraViewHeightToButtons(); virtual views::View* GetInitiallyFocusedView(); // Overridden from ui::ComboboxModel: diff --git a/chrome/browser/ui/views/download_shelf_view.cc b/chrome/browser/ui/views/download_shelf_view.cc index b37804f..a8180f9 100644 --- a/chrome/browser/ui/views/download_shelf_view.cc +++ b/chrome/browser/ui/views/download_shelf_view.cc @@ -385,6 +385,10 @@ void DownloadShelfView::Close() { shelf_animation_->Hide(); } +Browser* DownloadShelfView::browser() const { + return browser_; +} + void DownloadShelfView::Closed() { // When the close animation is complete, remove all completed downloads. size_t i = 0; diff --git a/chrome/browser/ui/views/download_shelf_view.h b/chrome/browser/ui/views/download_shelf_view.h index 10f65fa..25d1601 100644 --- a/chrome/browser/ui/views/download_shelf_view.h +++ b/chrome/browser/ui/views/download_shelf_view.h @@ -70,7 +70,7 @@ class DownloadShelfView : public AccessiblePaneView, virtual bool IsClosing() const; virtual void Show(); virtual void Close(); - virtual Browser* browser() const { return browser_; } + virtual Browser* browser() const; // Implementation of MouseWatcherDelegate. virtual void MouseMovedOutOfView(); @@ -96,7 +96,7 @@ class DownloadShelfView : public AccessiblePaneView, void AddDownloadView(DownloadItemView* view); // Paints the border. - void OnPaintBorder(gfx::Canvas* canvas); + virtual void OnPaintBorder(gfx::Canvas* canvas); // Returns true if the shelf is wide enough to show the first download item. bool CanFitFirstDownloadItem(); diff --git a/chrome/browser/ui/views/extensions/extension_installed_bubble.cc b/chrome/browser/ui/views/extensions/extension_installed_bubble.cc index 9ea61f3..08d7c6c 100644 --- a/chrome/browser/ui/views/extensions/extension_installed_bubble.cc +++ b/chrome/browser/ui/views/extensions/extension_installed_bubble.cc @@ -270,6 +270,8 @@ ExtensionInstalledBubble::ExtensionInstalledBubble(const Extension* extension, Source<Profile>(browser->profile())); } +ExtensionInstalledBubble::~ExtensionInstalledBubble() {} + void ExtensionInstalledBubble::Observe(NotificationType type, const NotificationSource& source, const NotificationDetails& details) { @@ -370,3 +372,11 @@ void ExtensionInstalledBubble::InfoBubbleClosing(InfoBubble* info_bubble, Release(); // Balanced in ctor. } + +bool ExtensionInstalledBubble::CloseOnEscape() { + return true; +} + +bool ExtensionInstalledBubble::FadeInOnShow() { + return true; +} diff --git a/chrome/browser/ui/views/extensions/extension_installed_bubble.h b/chrome/browser/ui/views/extensions/extension_installed_bubble.h index ff15b6d..20060eb 100644 --- a/chrome/browser/ui/views/extensions/extension_installed_bubble.h +++ b/chrome/browser/ui/views/extensions/extension_installed_bubble.h @@ -54,7 +54,7 @@ class ExtensionInstalledBubble ExtensionInstalledBubble(const Extension* extension, Browser *browser, SkBitmap icon); - ~ExtensionInstalledBubble() {} + virtual ~ExtensionInstalledBubble(); // Shows the bubble. Called internally via PostTask. void ShowInternal(); @@ -67,8 +67,8 @@ class ExtensionInstalledBubble // InfoBubbleDelegate virtual void InfoBubbleClosing(InfoBubble* info_bubble, bool closed_by_escape); - virtual bool CloseOnEscape() { return true; } - virtual bool FadeInOnShow() { return true; } + virtual bool CloseOnEscape(); + virtual bool FadeInOnShow(); const Extension* extension_; Browser* browser_; diff --git a/chrome/browser/ui/views/frame/browser_bubble_host.cc b/chrome/browser/ui/views/frame/browser_bubble_host.cc index ed13309..4a08f86 100644 --- a/chrome/browser/ui/views/frame/browser_bubble_host.cc +++ b/chrome/browser/ui/views/frame/browser_bubble_host.cc @@ -7,6 +7,10 @@ #include "base/logging.h" #include "chrome/browser/ui/views/browser_bubble.h" +BrowserBubbleHost::BrowserBubbleHost() {} + +BrowserBubbleHost::~BrowserBubbleHost() {} + void BrowserBubbleHost::WindowMoved() { // Do safe iteration in case the bubble winds up closing as a result of this // message. diff --git a/chrome/browser/ui/views/frame/browser_bubble_host.h b/chrome/browser/ui/views/frame/browser_bubble_host.h index 990f39e..139befb 100644 --- a/chrome/browser/ui/views/frame/browser_bubble_host.h +++ b/chrome/browser/ui/views/frame/browser_bubble_host.h @@ -17,7 +17,8 @@ class BrowserBubble; // close events. class BrowserBubbleHost { public: - BrowserBubbleHost() {} + BrowserBubbleHost(); + ~BrowserBubbleHost(); // Invoked when the window containing the attached browser-bubbles is moved. // Calls BrowserBubble::BrowserWindowMoved on all attached bubbles. diff --git a/chrome/browser/ui/views/frame/browser_view.h b/chrome/browser/ui/views/frame/browser_view.h index fecd185..d33ccbe7 100644 --- a/chrome/browser/ui/views/frame/browser_view.h +++ b/chrome/browser/ui/views/frame/browser_view.h @@ -171,7 +171,7 @@ class BrowserView : public BrowserBubbleHost, bool ShouldShowOffTheRecordAvatar() const; // Handle the specified |accelerator| being pressed. - bool AcceleratorPressed(const views::Accelerator& accelerator); + virtual bool AcceleratorPressed(const views::Accelerator& accelerator); // Provides the containing frame with the accelerator for the specified // command id. This can be used to provide menu item shortcut hints etc. @@ -228,7 +228,7 @@ class BrowserView : public BrowserBubbleHost, bool IsPositionInWindowCaption(const gfx::Point& point); // Returns whether the fullscreen bubble is visible or not. - bool IsFullscreenBubbleVisible() const; + virtual bool IsFullscreenBubbleVisible() const; // Invoked from the frame when the full screen state changes. This is only // used on Linux. diff --git a/chrome/browser/ui/views/info_bubble.cc b/chrome/browser/ui/views/info_bubble.cc index 632d750..eafec4f 100644 --- a/chrome/browser/ui/views/info_bubble.cc +++ b/chrome/browser/ui/views/info_bubble.cc @@ -239,6 +239,12 @@ LRESULT BorderWidget::OnMouseActivate(HWND window, } #endif +// InfoBubbleDelegate --------------------------------------------------------- + +std::wstring InfoBubbleDelegate::accessible_name() { + return L""; +} + // InfoBubble ----------------------------------------------------------------- // static diff --git a/chrome/browser/ui/views/info_bubble.h b/chrome/browser/ui/views/info_bubble.h index 36f7998..f8c8571 100644 --- a/chrome/browser/ui/views/info_bubble.h +++ b/chrome/browser/ui/views/info_bubble.h @@ -171,7 +171,7 @@ class InfoBubbleDelegate { virtual bool FadeInOnShow() = 0; // The name of the window to which this delegate belongs. - virtual std::wstring accessible_name() { return L""; } + virtual std::wstring accessible_name(); }; // TODO(sky): this code is ifdef-tastic. It might be cleaner to refactor the diff --git a/chrome/browser/ui/views/js_modal_dialog_views.cc b/chrome/browser/ui/views/js_modal_dialog_views.cc index 6657ade..f6ae4d6 100644 --- a/chrome/browser/ui/views/js_modal_dialog_views.cc +++ b/chrome/browser/ui/views/js_modal_dialog_views.cc @@ -133,6 +133,10 @@ std::wstring JSModalDialogViews::GetDialogButtonLabel( /////////////////////////////////////////////////////////////////////////////// // JSModalDialogViews, views::WindowDelegate implementation: +bool JSModalDialogViews::IsModal() const { + return true; +} + views::View* JSModalDialogViews::GetContentsView() { return message_box_view_; } diff --git a/chrome/browser/ui/views/js_modal_dialog_views.h b/chrome/browser/ui/views/js_modal_dialog_views.h index 1a9a7c3..8dcdfab 100644 --- a/chrome/browser/ui/views/js_modal_dialog_views.h +++ b/chrome/browser/ui/views/js_modal_dialog_views.h @@ -42,7 +42,7 @@ class JSModalDialogViews : public NativeAppModalDialog, ui::MessageBoxFlags::DialogButton button) const; // Overridden from views::WindowDelegate: - virtual bool IsModal() const { return true; } + virtual bool IsModal() const; virtual views::View* GetContentsView(); virtual views::View* GetInitiallyFocusedView(); virtual void OnClose(); diff --git a/chrome/browser/ui/views/location_bar/content_setting_image_view.cc b/chrome/browser/ui/views/location_bar/content_setting_image_view.cc index be5c7fb..b342465 100644 --- a/chrome/browser/ui/views/location_bar/content_setting_image_view.cc +++ b/chrome/browser/ui/views/location_bar/content_setting_image_view.cc @@ -227,6 +227,10 @@ bool ContentSettingImageView::CloseOnEscape() { return true; } +bool ContentSettingImageView::FadeInOnShow() { + return false; +} + void ContentSettingImageView::AnimateToState(double state) { if (state >= 1.0) { // Animaton is over, clear the variables. diff --git a/chrome/browser/ui/views/location_bar/content_setting_image_view.h b/chrome/browser/ui/views/location_bar/content_setting_image_view.h index 5e876fd..ef6ffd1 100644 --- a/chrome/browser/ui/views/location_bar/content_setting_image_view.h +++ b/chrome/browser/ui/views/location_bar/content_setting_image_view.h @@ -52,7 +52,7 @@ class ContentSettingImageView : public views::ImageView, virtual void InfoBubbleClosing(InfoBubble* info_bubble, bool closed_by_escape); virtual bool CloseOnEscape(); - virtual bool FadeInOnShow() { return false; } + virtual bool FadeInOnShow(); // ui::LinearAnimation override: virtual void AnimateToState(double state); diff --git a/chrome/browser/ui/views/location_bar/location_bar_view.cc b/chrome/browser/ui/views/location_bar/location_bar_view.cc index ad5f83c..9b461e3 100644 --- a/chrome/browser/ui/views/location_bar/location_bar_view.cc +++ b/chrome/browser/ui/views/location_bar/location_bar_view.cc @@ -1149,6 +1149,22 @@ void LocationBarView::Revert() { location_entry_->RevertAll(); } +const AutocompleteEditView* LocationBarView::location_entry() const { + return location_entry_.get(); +} + +AutocompleteEditView* LocationBarView::location_entry() { + return location_entry_.get(); +} + +LocationBarTesting* LocationBarView::GetLocationBarForTesting() { + return this; +} + +int LocationBarView::PageActionCount() { + return page_action_views_.size(); +} + int LocationBarView::PageActionVisibleCount() { int result = 0; for (size_t i = 0; i < page_action_views_.size(); i++) { diff --git a/chrome/browser/ui/views/location_bar/location_bar_view.h b/chrome/browser/ui/views/location_bar/location_bar_view.h index 2d53468..44e3f11 100644 --- a/chrome/browser/ui/views/location_bar/location_bar_view.h +++ b/chrome/browser/ui/views/location_bar/location_bar_view.h @@ -235,18 +235,12 @@ class LocationBarView : public LocationBar, virtual void InvalidatePageActions() OVERRIDE; virtual void SaveStateToContents(TabContents* contents) OVERRIDE; virtual void Revert() OVERRIDE; - virtual const AutocompleteEditView* location_entry() const OVERRIDE { - return location_entry_.get(); - } - virtual AutocompleteEditView* location_entry() OVERRIDE { - return location_entry_.get(); - } - virtual LocationBarTesting* GetLocationBarForTesting() OVERRIDE { - return this; - } + virtual const AutocompleteEditView* location_entry() const OVERRIDE; + virtual AutocompleteEditView* location_entry() OVERRIDE; + virtual LocationBarTesting* GetLocationBarForTesting() OVERRIDE; // Overridden from LocationBarTesting: - virtual int PageActionCount() OVERRIDE { return page_action_views_.size(); } + virtual int PageActionCount() OVERRIDE; virtual int PageActionVisibleCount() OVERRIDE; virtual ExtensionAction* GetPageAction(size_t index) OVERRIDE; virtual ExtensionAction* GetVisiblePageAction(size_t index) OVERRIDE; diff --git a/chrome/browser/ui/views/location_bar/star_view.cc b/chrome/browser/ui/views/location_bar/star_view.cc index 886aec2..ad1a15f 100644 --- a/chrome/browser/ui/views/location_bar/star_view.cc +++ b/chrome/browser/ui/views/location_bar/star_view.cc @@ -73,3 +73,7 @@ void StarView::InfoBubbleClosing(InfoBubble* info_bubble, bool StarView::CloseOnEscape() { return true; } + +bool StarView::FadeInOnShow() { + return false; +} diff --git a/chrome/browser/ui/views/location_bar/star_view.h b/chrome/browser/ui/views/location_bar/star_view.h index ad02f9e..cd80a00 100644 --- a/chrome/browser/ui/views/location_bar/star_view.h +++ b/chrome/browser/ui/views/location_bar/star_view.h @@ -37,7 +37,7 @@ class StarView : public views::ImageView, public InfoBubbleDelegate { virtual void InfoBubbleClosing(InfoBubble* info_bubble, bool closed_by_escape); virtual bool CloseOnEscape(); - virtual bool FadeInOnShow() { return false; } + virtual bool FadeInOnShow(); // The CommandUpdater for the Browser object that owns the location bar. CommandUpdater* command_updater_; diff --git a/chrome/browser/ui/views/options/options_page_view.cc b/chrome/browser/ui/views/options/options_page_view.cc index b81b3af..ec0c109 100644 --- a/chrome/browser/ui/views/options/options_page_view.cc +++ b/chrome/browser/ui/views/options/options_page_view.cc @@ -21,6 +21,10 @@ OptionsPageView::~OptionsPageView() { /////////////////////////////////////////////////////////////////////////////// // OptionsPageView, views::View overrides: +bool OptionsPageView::CanClose() const { + return true; +} + void OptionsPageView::ViewHierarchyChanged(bool is_add, views::View* parent, views::View* child) { diff --git a/chrome/browser/ui/views/options/options_page_view.h b/chrome/browser/ui/views/options/options_page_view.h index bbbc8c4..c26cc9f 100644 --- a/chrome/browser/ui/views/options/options_page_view.h +++ b/chrome/browser/ui/views/options/options_page_view.h @@ -26,7 +26,7 @@ class OptionsPageView : public views::View, // Returns true if the window containing this view can be closed, given the // current state of this view. This can be used to prevent the window from // being closed when a modal dialog box is showing, for example. - virtual bool CanClose() const { return true; } + virtual bool CanClose() const; protected: // This class cannot be instantiated directly, but its constructor must be diff --git a/chrome/browser/ui/views/page_info_bubble_view.cc b/chrome/browser/ui/views/page_info_bubble_view.cc index cd3fcc3..b112a00 100644 --- a/chrome/browser/ui/views/page_info_bubble_view.cc +++ b/chrome/browser/ui/views/page_info_bubble_view.cc @@ -207,6 +207,18 @@ void PageInfoBubbleView::ModelChanged() { resize_animation_.Show(); } +bool PageInfoBubbleView::CloseOnEscape() { + return true; +} + +bool PageInfoBubbleView::FadeInOnShow() { + return false; +} + +std::wstring PageInfoBubbleView::accessible_name() { + return L"PageInfoBubble"; +} + void PageInfoBubbleView::LinkActivated(views::Link* source, int event_flags) { // We want to make sure the info bubble closes once the link is activated. So // we close it explicitly rather than relying on a side-effect of opening a diff --git a/chrome/browser/ui/views/page_info_bubble_view.h b/chrome/browser/ui/views/page_info_bubble_view.h index 0f57d5a..4483b50 100644 --- a/chrome/browser/ui/views/page_info_bubble_view.h +++ b/chrome/browser/ui/views/page_info_bubble_view.h @@ -44,9 +44,9 @@ class PageInfoBubbleView : public views::View, // InfoBubbleDelegate methods: virtual void InfoBubbleClosing(InfoBubble* info_bubble, bool closed_by_escape) {} - virtual bool CloseOnEscape() { return true; } - virtual bool FadeInOnShow() { return false; } - virtual std::wstring accessible_name() { return L"PageInfoBubble"; } + virtual bool CloseOnEscape(); + virtual bool FadeInOnShow(); + virtual std::wstring accessible_name(); // LinkController methods: virtual void LinkActivated(views::Link* source, int event_flags); diff --git a/chrome/browser/ui/views/sad_tab_view.cc b/chrome/browser/ui/views/sad_tab_view.cc index fc79866..85e500e 100644 --- a/chrome/browser/ui/views/sad_tab_view.cc +++ b/chrome/browser/ui/views/sad_tab_view.cc @@ -70,6 +70,8 @@ SadTabView::SadTabView(TabContents* tab_contents, Kind kind) } } +SadTabView::~SadTabView() {} + void SadTabView::OnPaint(gfx::Canvas* canvas) { SkPaint paint; SkSafeUnref(paint.setShader( diff --git a/chrome/browser/ui/views/sad_tab_view.h b/chrome/browser/ui/views/sad_tab_view.h index 8694aa4..e87ecb4 100644 --- a/chrome/browser/ui/views/sad_tab_view.h +++ b/chrome/browser/ui/views/sad_tab_view.h @@ -31,7 +31,7 @@ class SadTabView : public views::View, }; explicit SadTabView(TabContents* tab_contents, Kind kind); - virtual ~SadTabView() {} + virtual ~SadTabView(); // Overridden from views::View: virtual void OnPaint(gfx::Canvas* canvas); diff --git a/chrome/browser/ui/views/tabs/base_tab.cc b/chrome/browser/ui/views/tabs/base_tab.cc index 740dc1d..e6d6bc8 100644 --- a/chrome/browser/ui/views/tabs/base_tab.cc +++ b/chrome/browser/ui/views/tabs/base_tab.cc @@ -480,6 +480,18 @@ void BaseTab::ShowContextMenuForView(views::View* source, controller()->ShowContextMenuForTab(this, p); } +int BaseTab::loading_animation_frame() const { + return loading_animation_frame_; +} + +bool BaseTab::should_display_crashed_favicon() const { + return should_display_crashed_favicon_; +} + +int BaseTab::fav_icon_hiding_offset() const { + return fav_icon_hiding_offset_; +} + void BaseTab::SetFavIconHidingOffset(int offset) { fav_icon_hiding_offset_ = offset; ScheduleIconPaint(); diff --git a/chrome/browser/ui/views/tabs/base_tab.h b/chrome/browser/ui/views/tabs/base_tab.h index f51eab9..7767df3e 100644 --- a/chrome/browser/ui/views/tabs/base_tab.h +++ b/chrome/browser/ui/views/tabs/base_tab.h @@ -136,13 +136,9 @@ class BaseTab : public ui::AnimationDelegate, virtual const gfx::Rect& GetTitleBounds() const = 0; virtual const gfx::Rect& GetIconBounds() const = 0; - virtual int loading_animation_frame() const { - return loading_animation_frame_; - } - virtual bool should_display_crashed_favicon() const { - return should_display_crashed_favicon_; - } - virtual int fav_icon_hiding_offset() const { return fav_icon_hiding_offset_; } + virtual int loading_animation_frame() const; + virtual bool should_display_crashed_favicon() const; + virtual int fav_icon_hiding_offset() const; static gfx::Font* font() { return font_; } static int font_height() { return font_height_; } diff --git a/chrome/browser/ui/views/tabs/base_tab_strip.cc b/chrome/browser/ui/views/tabs/base_tab_strip.cc index 715e2e2..9a57e0f 100644 --- a/chrome/browser/ui/views/tabs/base_tab_strip.cc +++ b/chrome/browser/ui/views/tabs/base_tab_strip.cc @@ -390,6 +390,10 @@ void BaseTabStrip::StartMiniTabAnimation() { AnimateToIdealBounds(); } +bool BaseTabStrip::ShouldHighlightCloseButtonAfterRemove() { + return true; +} + void BaseTabStrip::RemoveAndDeleteTab(BaseTab* tab) { int tab_data_index = TabIndexOfTab(tab); diff --git a/chrome/browser/ui/views/tabs/base_tab_strip.h b/chrome/browser/ui/views/tabs/base_tab_strip.h index fd92839..e6e9677 100644 --- a/chrome/browser/ui/views/tabs/base_tab_strip.h +++ b/chrome/browser/ui/views/tabs/base_tab_strip.h @@ -173,7 +173,7 @@ class BaseTabStrip : public views::View, virtual void StartMiniTabAnimation(); // Returns whether the highlight button should be highlighted after a remove. - virtual bool ShouldHighlightCloseButtonAfterRemove() { return true; } + virtual bool ShouldHighlightCloseButtonAfterRemove(); // Animates all the views to their ideal bounds. // NOTE: this does *not* invoke GenerateIdealBounds, it uses the bounds diff --git a/chrome/browser/ui/views/tabs/tab.cc b/chrome/browser/ui/views/tabs/tab.cc index 56c268a..e6cf2f0 100644 --- a/chrome/browser/ui/views/tabs/tab.cc +++ b/chrome/browser/ui/views/tabs/tab.cc @@ -310,6 +310,10 @@ void Tab::OnThemeChanged() { LoadTabImages(); } +std::string Tab::GetClassName() const { + return kViewClassName; +} + bool Tab::HasHitTestMask() const { return true; } diff --git a/chrome/browser/ui/views/tabs/tab.h b/chrome/browser/ui/views/tabs/tab.h index debd280..6eb1765d 100644 --- a/chrome/browser/ui/views/tabs/tab.h +++ b/chrome/browser/ui/views/tabs/tab.h @@ -66,7 +66,7 @@ class Tab : public BaseTab { virtual void OnPaint(gfx::Canvas* canvas); virtual void Layout(); virtual void OnThemeChanged(); - virtual std::string GetClassName() const { return kViewClassName; } + virtual std::string GetClassName() const; virtual bool HasHitTestMask() const; virtual void GetHitTestMask(gfx::Path* path) const; virtual bool GetTooltipTextOrigin(const gfx::Point& p, gfx::Point* origin); diff --git a/chrome/browser/ui/views/tabs/tab_renderer_data.cc b/chrome/browser/ui/views/tabs/tab_renderer_data.cc new file mode 100644 index 0000000..47f96d6 --- /dev/null +++ b/chrome/browser/ui/views/tabs/tab_renderer_data.cc @@ -0,0 +1,34 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/ui/views/tabs/tab_renderer_data.h" + +TabRendererData::TabRendererData() + : network_state(NETWORK_STATE_NONE), + loading(false), + crashed_status(base::TERMINATION_STATUS_STILL_RUNNING), + off_the_record(false), + show_icon(true), + mini(false), + blocked(false), + app(false) { +} + +TabRendererData::~TabRendererData() {} + +bool TabRendererData::Equals(const TabRendererData& data) { + return + favicon.pixelRef() && + favicon.pixelRef() == data.favicon.pixelRef() && + favicon.pixelRefOffset() == data.favicon.pixelRefOffset() && + network_state == data.network_state && + title == data.title && + loading == data.loading && + crashed_status == data.crashed_status && + off_the_record == data.off_the_record && + show_icon == data.show_icon && + mini == data.mini && + blocked == data.blocked && + app == data.app; +} diff --git a/chrome/browser/ui/views/tabs/tab_renderer_data.h b/chrome/browser/ui/views/tabs/tab_renderer_data.h index 43962df..28b55fc 100644 --- a/chrome/browser/ui/views/tabs/tab_renderer_data.h +++ b/chrome/browser/ui/views/tabs/tab_renderer_data.h @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -21,16 +21,8 @@ struct TabRendererData { NETWORK_STATE_LOADING, // connected, transferring data. }; - TabRendererData() - : network_state(NETWORK_STATE_NONE), - loading(false), - crashed_status(base::TERMINATION_STATUS_STILL_RUNNING), - off_the_record(false), - show_icon(true), - mini(false), - blocked(false), - app(false) { - } + TabRendererData(); + ~TabRendererData(); // This interprets the crashed status to decide whether or not this // render data represents a tab that is "crashed" (i.e. the render @@ -43,21 +35,7 @@ struct TabRendererData { // Returns true if the TabRendererData is same as given |data|. Two favicons // are considered equals if two SkBitmaps point to the same SkPixelRef object. - bool Equals(const TabRendererData& data) { - return - favicon.pixelRef() && - favicon.pixelRef() == data.favicon.pixelRef() && - favicon.pixelRefOffset() == data.favicon.pixelRefOffset() && - network_state == data.network_state && - title == data.title && - loading == data.loading && - crashed_status == data.crashed_status && - off_the_record == data.off_the_record && - show_icon == data.show_icon && - mini == data.mini && - blocked == data.blocked && - app == data.app; - } + bool Equals(const TabRendererData& data); SkBitmap favicon; NetworkState network_state; diff --git a/chrome/browser/ui/views/tabs/tab_strip.h b/chrome/browser/ui/views/tabs/tab_strip.h index 7f0a339..42e717ec 100644 --- a/chrome/browser/ui/views/tabs/tab_strip.h +++ b/chrome/browser/ui/views/tabs/tab_strip.h @@ -209,13 +209,13 @@ class TabStrip : public BaseTabStrip, // animating to their desired position/bounds. This is used by the standard // Layout method and other callers like the DraggedTabController that need // stable representations of Tab positions. - void GenerateIdealBounds(); + virtual void GenerateIdealBounds(); // Starts various types of TabStrip animations. void StartResizeLayoutAnimation(); void StartMoveTabAnimation(int from_model_index, int to_model_index); - void StartMiniTabAnimation(); + virtual void StartMiniTabAnimation(); void StartMouseInitiatedRemoveTabAnimation(int model_index); // Calculates the available width for tabs, assuming a Tab is to be closed. diff --git a/chrome/browser/ui/views/theme_install_bubble_view.h b/chrome/browser/ui/views/theme_install_bubble_view.h index 450d4cf..b363073 100644 --- a/chrome/browser/ui/views/theme_install_bubble_view.h +++ b/chrome/browser/ui/views/theme_install_bubble_view.h @@ -34,7 +34,7 @@ class Widget; class ThemeInstallBubbleView : public NotificationObserver, public views::Label { public: - ~ThemeInstallBubbleView(); + virtual ~ThemeInstallBubbleView(); // NotificationObserver virtual void Observe(NotificationType type, @@ -51,7 +51,7 @@ class ThemeInstallBubbleView : public NotificationObserver, void Reposition(); // Inherited from views. - gfx::Size GetPreferredSize(); + virtual gfx::Size GetPreferredSize(); // Shut down the popup and remove our notifications. void Close(); |