diff options
author | saintlou@chromium.org <saintlou@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-23 20:44:57 +0000 |
---|---|---|
committer | saintlou@chromium.org <saintlou@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-23 20:44:57 +0000 |
commit | d1e4a3dc13d6dd1d54b264b1afdd61aa329a787d (patch) | |
tree | 8c8175fc4583af340098d0ba36ade986ca1dca03 | |
parent | 821960ab4a099ee5f674211a64b620893cf7a2c8 (diff) | |
download | chromium_src-d1e4a3dc13d6dd1d54b264b1afdd61aa329a787d.zip chromium_src-d1e4a3dc13d6dd1d54b264b1afdd61aa329a787d.tar.gz chromium_src-d1e4a3dc13d6dd1d54b264b1afdd61aa329a787d.tar.bz2 |
Revert "This is a redo of http://codereview.chromium.org/7629009/"
This reverts commit 59e1c15b1ee0e29742a2479527de09715a2e5525.
TBR=saintlou@chromium.org
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/7720010
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@97914 0039d316-1c4b-4281-b951-d872f2087c98
42 files changed, 186 insertions, 225 deletions
diff --git a/chrome/browser/chromeos/frame/bubble_frame_view.cc b/chrome/browser/chromeos/frame/bubble_frame_view.cc index 4d7cba8a..c0981b4 100644 --- a/chrome/browser/chromeos/frame/bubble_frame_view.cc +++ b/chrome/browser/chromeos/frame/bubble_frame_view.cc @@ -6,7 +6,7 @@ #include "chrome/browser/chromeos/frame/bubble_window.h" #include "chrome/browser/chromeos/login/helper.h" -#include "views/bubble/bubble_border.h" +#include "chrome/browser/ui/views/bubble/bubble_border.h" #include "grit/theme_resources_standard.h" #include "ui/base/resource/resource_bundle.h" #include "ui/gfx/canvas_skia.h" @@ -47,7 +47,7 @@ BubbleFrameView::BubbleFrameView(views::Widget* frame, title_(NULL), close_button_(NULL), throbber_(NULL) { - set_border(new views::BubbleBorder(views::BubbleBorder::NONE)); + set_border(new BubbleBorder(BubbleBorder::NONE)); if (widget_delegate->ShouldShowWindowTitle()) { title_ = new views::Label(widget_delegate->GetWindowTitle()); @@ -218,7 +218,7 @@ void BubbleFrameView::OnPaint(gfx::Canvas* canvas) { SkRect rect; rect.set(SkIntToScalar(bounds.x()), SkIntToScalar(bounds.y()), SkIntToScalar(bounds.right()), SkIntToScalar(bounds.bottom())); - SkScalar radius = SkIntToScalar(views::BubbleBorder::GetCornerRadius()); + SkScalar radius = SkIntToScalar(BubbleBorder::GetCornerRadius()); path.addRoundRect(rect, radius, radius); canvas->AsCanvasSkia()->drawPath(path, paint); diff --git a/chrome/browser/chromeos/login/message_bubble.cc b/chrome/browser/chromeos/login/message_bubble.cc index e0c8605..76b2812 100644 --- a/chrome/browser/chromeos/login/message_bubble.cc +++ b/chrome/browser/chromeos/login/message_bubble.cc @@ -113,14 +113,13 @@ void MessageBubble::LinkClicked(views::Link* source, int event_flags) { } // static -MessageBubble* MessageBubble::Show( - views::Widget* parent, - const gfx::Rect& position_relative_to, - views::BubbleBorder::ArrowLocation arrow_location, - SkBitmap* image, - const std::wstring& text, - const std::wstring& help, - MessageBubbleDelegate* delegate) { +MessageBubble* MessageBubble::Show(views::Widget* parent, + const gfx::Rect& position_relative_to, + BubbleBorder::ArrowLocation arrow_location, + SkBitmap* image, + const std::wstring& text, + const std::wstring& help, + MessageBubbleDelegate* delegate) { std::vector<std::wstring> links; if (!help.empty()) links.push_back(help); @@ -137,7 +136,7 @@ MessageBubble* MessageBubble::Show( MessageBubble* MessageBubble::ShowWithLinks( views::Widget* parent, const gfx::Rect& position_relative_to, - views::BubbleBorder::ArrowLocation arrow_location, + BubbleBorder::ArrowLocation arrow_location, SkBitmap* image, const std::wstring& text, const std::vector<std::wstring>& links, @@ -155,7 +154,7 @@ MessageBubble* MessageBubble::ShowWithLinks( MessageBubble* MessageBubble::ShowNoGrab( views::Widget* parent, const gfx::Rect& position_relative_to, - views::BubbleBorder::ArrowLocation arrow_location, + BubbleBorder::ArrowLocation arrow_location, SkBitmap* image, const std::wstring& text, const std::wstring& help, diff --git a/chrome/browser/chromeos/login/message_bubble.h b/chrome/browser/chromeos/login/message_bubble.h index 4852b06..d0a47c7 100644 --- a/chrome/browser/chromeos/login/message_bubble.h +++ b/chrome/browser/chromeos/login/message_bubble.h @@ -42,7 +42,7 @@ class MessageBubble : public Bubble, // |links| is an optional vector of links texts. static MessageBubble* Show(views::Widget* parent, const gfx::Rect& position_relative_to, - views::BubbleBorder::ArrowLocation arrow_location, + BubbleBorder::ArrowLocation arrow_location, SkBitmap* image, const std::wstring& text, const std::wstring& help, @@ -53,7 +53,7 @@ class MessageBubble : public Bubble, static MessageBubble* ShowWithLinks( views::Widget* parent, const gfx::Rect& position_relative_to, - views::BubbleBorder::ArrowLocation arrow_location, + BubbleBorder::ArrowLocation arrow_location, SkBitmap* image, const std::wstring& text, const std::vector<std::wstring>& links, @@ -62,14 +62,13 @@ class MessageBubble : public Bubble, // Create and show bubble which does not grab pointer. This creates // a TYPE_CHILD NativeWidgetGtk and |position_relative_to| must be in parent's // coordinates. - static MessageBubble* ShowNoGrab( - views::Widget* parent, - const gfx::Rect& position_relative_to, - views::BubbleBorder::ArrowLocation arrow_location, - SkBitmap* image, - const std::wstring& text, - const std::wstring& help, - MessageBubbleDelegate* delegate); + static MessageBubble* ShowNoGrab(views::Widget* parent, + const gfx::Rect& position_relative_to, + BubbleBorder::ArrowLocation arrow_location, + SkBitmap* image, + const std::wstring& text, + const std::wstring& help, + MessageBubbleDelegate* delegate); // Overridden from NativeWidgetGtk. virtual void Close() OVERRIDE; diff --git a/chrome/browser/chromeos/login/screen_locker.cc b/chrome/browser/chromeos/login/screen_locker.cc index fe1616b..9dc6cbd 100644 --- a/chrome/browser/chromeos/login/screen_locker.cc +++ b/chrome/browser/chromeos/login/screen_locker.cc @@ -849,7 +849,7 @@ void ScreenLocker::OnLoginFailure(const LoginFailure& error) { msg += ASCIIToUTF16("\n") + l10n_util::GetStringUTF16(IDS_LOGIN_ERROR_KEYBOARD_SWITCH_HINT); - ShowErrorBubble(UTF16ToWide(msg), views::BubbleBorder::BOTTOM_LEFT); + ShowErrorBubble(UTF16ToWide(msg), BubbleBorder::BOTTOM_LEFT); if (login_status_consumer_) login_status_consumer_->OnLoginFailure(error); @@ -1012,9 +1012,8 @@ void ScreenLocker::ShowErrorMessage(const std::wstring& message, } screen_lock_view_->SetSignoutEnabled(sign_out_only); // Make sure that active Sign Out button is not hidden behind the bubble. - ShowErrorBubble( - message, sign_out_only ? - views::BubbleBorder::BOTTOM_RIGHT : views::BubbleBorder::BOTTOM_LEFT); + ShowErrorBubble(message, sign_out_only ? + BubbleBorder::BOTTOM_RIGHT : BubbleBorder::BOTTOM_LEFT); } void ScreenLocker::OnGrabInputs() { @@ -1171,9 +1170,8 @@ void ScreenLocker::OnWindowManagerReady() { ScreenLockReady(); } -void ScreenLocker::ShowErrorBubble( - const std::wstring& message, - views::BubbleBorder::ArrowLocation arrow_location) { +void ScreenLocker::ShowErrorBubble(const std::wstring& message, + BubbleBorder::ArrowLocation arrow_location) { if (error_info_) error_info_->Close(); diff --git a/chrome/browser/chromeos/login/screen_locker.h b/chrome/browser/chromeos/login/screen_locker.h index e7f16cd..514db65 100644 --- a/chrome/browser/chromeos/login/screen_locker.h +++ b/chrome/browser/chromeos/login/screen_locker.h @@ -157,7 +157,7 @@ class ScreenLocker : public LoginStatusConsumer, // Shows error_info_ bubble with the |message| and |arrow_location| specified. // Assumes that UI controls were locked before that. void ShowErrorBubble(const std::wstring& message, - views::BubbleBorder::ArrowLocation arrow_location); + BubbleBorder::ArrowLocation arrow_location); // Stops screen saver. void StopScreenSaver(); diff --git a/chrome/browser/chromeos/login/views_login_display.cc b/chrome/browser/chromeos/login/views_login_display.cc index eae6fe7..1e7627a 100644 --- a/chrome/browser/chromeos/login/views_login_display.cc +++ b/chrome/browser/chromeos/login/views_login_display.cc @@ -209,13 +209,13 @@ void ViewsLoginDisplay::ShowError(int error_msg_id, gfx::Rect bounds = controllers_[selected_view_index_]->GetMainInputScreenBounds(); - views::BubbleBorder::ArrowLocation arrow; + BubbleBorder::ArrowLocation arrow; if (controllers_[selected_view_index_]->is_new_user()) { - arrow = views::BubbleBorder::LEFT_TOP; + arrow = BubbleBorder::LEFT_TOP; } else { // Point info bubble arrow to cursor position (approximately). bounds.set_width(kCursorOffset * 2); - arrow = views::BubbleBorder::BOTTOM_LEFT; + arrow = BubbleBorder::BOTTOM_LEFT; } string16 help_link; diff --git a/chrome/browser/chromeos/login/views_network_screen_actor.cc b/chrome/browser/chromeos/login/views_network_screen_actor.cc index 0f11440..d806a6d 100644 --- a/chrome/browser/chromeos/login/views_network_screen_actor.cc +++ b/chrome/browser/chromeos/login/views_network_screen_actor.cc @@ -97,7 +97,7 @@ void ViewsNetworkScreenActor::ShowError(const string16& message) { bubble_ = MessageBubble::Show( network_control->GetWidget(), network_control->GetScreenBounds(), - views::BubbleBorder::LEFT_TOP, + BubbleBorder::LEFT_TOP, ResourceBundle::GetSharedInstance().GetBitmapNamed(IDR_WARNING), UTF16ToWide(message), UTF16ToWide(l10n_util::GetStringUTF16(IDS_LEARN_MORE)), diff --git a/chrome/browser/chromeos/setting_level_bubble.cc b/chrome/browser/chromeos/setting_level_bubble.cc index eed33ea..4320ea1 100644 --- a/chrome/browser/chromeos/setting_level_bubble.cc +++ b/chrome/browser/chromeos/setting_level_bubble.cc @@ -131,7 +131,7 @@ void SettingLevelBubble::ShowBubble(double percent, bool enabled) { bubble_ = Bubble::ShowFocusless(parent_widget, position_relative_to, - views::BubbleBorder::FLOAT, + BubbleBorder::FLOAT, view_, // contents this, // delegate true); // show while screen is locked diff --git a/chrome/browser/chromeos/status/network_menu_button.cc b/chrome/browser/chromeos/status/network_menu_button.cc index 5d34934..e8d8f3a 100644 --- a/chrome/browser/chromeos/status/network_menu_button.cc +++ b/chrome/browser/chromeos/status/network_menu_button.cc @@ -417,7 +417,7 @@ void NetworkMenuButton::ShowOptionalMobileDataPromoNotification( mobile_data_bubble_ = MessageBubble::ShowWithLinks( GetWidget(), button_bounds, - views::BubbleBorder::TOP_RIGHT , + BubbleBorder::TOP_RIGHT , ResourceBundle::GetSharedInstance().GetBitmapNamed(IDR_NOTIFICATION_3G), notification_text, links, diff --git a/chrome/browser/external_tab_container_win.cc b/chrome/browser/external_tab_container_win.cc index af6e945..aa66e70 100644 --- a/chrome/browser/external_tab_container_win.cc +++ b/chrome/browser/external_tab_container_win.cc @@ -594,8 +594,7 @@ void ExternalTabContainer::ShowPageInfo(Profile* profile, PageInfoBubbleView* page_info_bubble = new ExternalTabPageInfoBubbleView(this, NULL, profile, url, ssl, show_history); - Bubble* bubble = Bubble::Show(GetWidget(), bounds, - views::BubbleBorder::TOP_LEFT, + Bubble* bubble = Bubble::Show(GetWidget(), bounds, BubbleBorder::TOP_LEFT, page_info_bubble, page_info_bubble); page_info_bubble->set_bubble(bubble); } diff --git a/chrome/browser/speech/speech_input_bubble_views.cc b/chrome/browser/speech/speech_input_bubble_views.cc index 1032803..0daa7df 100644 --- a/chrome/browser/speech/speech_input_bubble_views.cc +++ b/chrome/browser/speech/speech_input_bubble_views.cc @@ -367,7 +367,7 @@ void SpeechInputBubbleImpl::Show() { } bubble_ = Bubble::Show(toplevel_widget, target_rect, - views::BubbleBorder::TOP_LEFT, bubble_content_, + BubbleBorder::TOP_LEFT, bubble_content_, this); // We don't want fade outs when closing because it makes speech recognition // appear slower than it is. Also setting it to false allows |Close| to diff --git a/chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.cc b/chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.cc index 10cf688..4f60c52 100644 --- a/chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.cc +++ b/chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.cc @@ -12,6 +12,7 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/omnibox/omnibox_view.h" #include "chrome/browser/ui/views/autocomplete/autocomplete_result_view.h" +#include "chrome/browser/ui/views/bubble/bubble_border.h" #include "chrome/browser/ui/views/location_bar/location_bar_view.h" #include "grit/chromium_strings.h" #include "grit/generated_resources.h" @@ -24,7 +25,6 @@ #include "ui/gfx/insets.h" #include "ui/gfx/path.h" #include "unicode/ubidi.h" -#include "views/bubble/bubble_border.h" #include "views/controls/button/text_button.h" #include "views/controls/label.h" #include "views/layout/grid_layout.h" @@ -241,8 +241,7 @@ AutocompletePopupContentsView::AutocompletePopupContentsView( ALLOW_THIS_IN_INITIALIZER_LIST(size_animation_(this)) { // The following little dance is required because set_border() requires a // pointer to a non-const object. - views::BubbleBorder* bubble_border = - new views::BubbleBorder(views::BubbleBorder::NONE); + BubbleBorder* bubble_border = new BubbleBorder(BubbleBorder::NONE); bubble_border_ = bubble_border; set_border(bubble_border); // The contents is owned by the LocationBarView. @@ -598,7 +597,7 @@ void AutocompletePopupContentsView::MakeContentsPath( SkIntToScalar(bounding_rect.right()), SkIntToScalar(bounding_rect.bottom())); - SkScalar radius = SkIntToScalar(views::BubbleBorder::GetCornerRadius()); + SkScalar radius = SkIntToScalar(BubbleBorder::GetCornerRadius()); path->addRoundRect(rect, radius, radius); } diff --git a/chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.h b/chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.h index c49fa6f..ba07542 100644 --- a/chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.h +++ b/chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.h @@ -19,6 +19,7 @@ class AutocompleteEditModel; struct AutocompleteMatch; class AutocompleteResultView; +class BubbleBorder; class Profile; namespace gfx { @@ -26,10 +27,6 @@ class CanvasSkia; class Insets; } -namespace views { -class BubbleBorder; -} - // A view representing the contents of the autocomplete popup. class AutocompletePopupContentsView : public views::View, public AutocompleteResultViewModel, @@ -151,7 +148,7 @@ class AutocompletePopupContentsView : public views::View, views::View* location_bar_; // Our border, which can compute our desired bounds. - const views::BubbleBorder* bubble_border_; + const BubbleBorder* bubble_border_; // The font that we should use for result rows. This is based on the font used // by the edit that created us. diff --git a/chrome/browser/ui/views/avatar_menu_button.cc b/chrome/browser/ui/views/avatar_menu_button.cc index f754f7d..7b99ee0 100644 --- a/chrome/browser/ui/views/avatar_menu_button.cc +++ b/chrome/browser/ui/views/avatar_menu_button.cc @@ -73,7 +73,6 @@ void AvatarMenuButton::RunMenu(views::View* source, const gfx::Point& pt) { AvatarMenuBubbleView* bubble_view = new AvatarMenuBubbleView(browser_); // Bubble::Show() takes ownership of the view. - Bubble::Show(browser_view->GetWidget(), bounds, - views::BubbleBorder::TOP_LEFT, + Bubble::Show(browser_view->GetWidget(), bounds, BubbleBorder::TOP_LEFT, bubble_view, bubble_view); } diff --git a/chrome/browser/ui/views/bookmarks/bookmark_bubble_view.cc b/chrome/browser/ui/views/bookmarks/bookmark_bubble_view.cc index e79ef8f..53393e66 100644 --- a/chrome/browser/ui/views/bookmarks/bookmark_bubble_view.cc +++ b/chrome/browser/ui/views/bookmarks/bookmark_bubble_view.cc @@ -91,7 +91,7 @@ void BookmarkBubbleView::Show(views::Widget* parent, bookmark_bubble_ = new BookmarkBubbleView(delegate, profile, url, newly_bookmarked); Bubble* bubble = Bubble::Show( - parent, bounds, views::BubbleBorder::TOP_RIGHT, bookmark_bubble_, + parent, bounds, BubbleBorder::TOP_RIGHT, bookmark_bubble_, bookmark_bubble_); // |bubble_| can be set to NULL in BubbleClosing when we close the bubble // asynchronously. However, that can happen during the Show call above if the diff --git a/chrome/browser/ui/views/browser_actions_container.cc b/chrome/browser/ui/views/browser_actions_container.cc index 1980660..a8a369e 100644 --- a/chrome/browser/ui/views/browser_actions_container.cc +++ b/chrome/browser/ui/views/browser_actions_container.cc @@ -510,8 +510,8 @@ void BrowserActionsContainer::OnBrowserActionExecuted( gfx::Rect rect = reference_view->bounds(); rect.set_origin(origin); - views::BubbleBorder::ArrowLocation arrow_location = base::i18n::IsRTL() ? - views::BubbleBorder::TOP_LEFT : views::BubbleBorder::TOP_RIGHT; + BubbleBorder::ArrowLocation arrow_location = base::i18n::IsRTL() ? + BubbleBorder::TOP_LEFT : BubbleBorder::TOP_RIGHT; popup_ = ExtensionPopup::Show(button->GetPopupUrl(), browser_, rect, arrow_location, inspect_with_devtools, diff --git a/chrome/browser/ui/views/browser_bubble.cc b/chrome/browser/ui/views/browser_bubble.cc index f826469..6dcd658 100644 --- a/chrome/browser/ui/views/browser_bubble.cc +++ b/chrome/browser/ui/views/browser_bubble.cc @@ -32,7 +32,7 @@ BrowserBubbleHost* GetBubbleHostFromFrame(views::Widget* frame) { BrowserBubble::BrowserBubble(views::View* view, views::Widget* frame, const gfx::Rect& relative_to, - views::BubbleBorder::ArrowLocation arrow_location) + BubbleBorder::ArrowLocation arrow_location) : frame_(frame), view_(view), relative_to_(relative_to), @@ -48,7 +48,7 @@ BrowserBubble::BrowserBubble(views::View* view, // Use half the corner radius as contents margins so that contents fit better // in the bubble. See http://crbug.com/80416. - int corner_inset = views::BubbleBorder::GetCornerRadius() / 2; + int corner_inset = BubbleBorder::GetCornerRadius() / 2; gfx::Insets content_margins(corner_inset, corner_inset, corner_inset, corner_inset); InitPopup(content_margins); @@ -146,3 +146,5 @@ void BrowserBubble::SetAbsoluteBounds(const gfx::Rect& window_bounds) { void BrowserBubble::MovePopup(int x, int y, int w, int h) { popup_->SetBounds(gfx::Rect(x, y, w, h)); } + + diff --git a/chrome/browser/ui/views/browser_bubble.h b/chrome/browser/ui/views/browser_bubble.h index 58bbc54..c74d40b 100644 --- a/chrome/browser/ui/views/browser_bubble.h +++ b/chrome/browser/ui/views/browser_bubble.h @@ -6,7 +6,7 @@ #define CHROME_BROWSER_UI_VIEWS_BROWSER_BUBBLE_H_ #pragma once -#include "views/bubble/bubble_border.h" +#include "chrome/browser/ui/views/bubble/bubble_border.h" #include "views/view.h" #include "views/widget/widget.h" @@ -48,7 +48,7 @@ class BrowserBubble { BrowserBubble(views::View* view, views::Widget* frame, const gfx::Rect& relative_to, - views::BubbleBorder::ArrowLocation arrow_location); + BubbleBorder::ArrowLocation arrow_location); virtual ~BrowserBubble(); // Call manually if you need to detach the bubble from tracking the browser's @@ -121,7 +121,7 @@ class BrowserBubble { gfx::Rect relative_to_; // Arrow location of this bubble. - views::BubbleBorder::ArrowLocation arrow_location_; + BubbleBorder::ArrowLocation arrow_location_; // The bounds relative to the frame. gfx::Rect bounds_; diff --git a/chrome/browser/ui/views/bubble/border_contents.cc b/chrome/browser/ui/views/bubble/border_contents.cc index 3503b19..ceb2a6d 100644 --- a/chrome/browser/ui/views/bubble/border_contents.cc +++ b/chrome/browser/ui/views/bubble/border_contents.cc @@ -15,7 +15,6 @@ static const int kTopMargin = 6; static const int kRightMargin = 6; static const int kBottomMargin = 9; - BorderContents::BorderContents() : bubble_border_(NULL), content_margins_(kTopMargin, kLeftMargin, kBottomMargin, kRightMargin) { @@ -23,15 +22,14 @@ BorderContents::BorderContents() void BorderContents::Init() { // Default arrow location. - views::BubbleBorder::ArrowLocation arrow_location = - views::BubbleBorder::TOP_LEFT; + BubbleBorder::ArrowLocation arrow_location = BubbleBorder::TOP_LEFT; if (base::i18n::IsRTL()) - arrow_location = views::BubbleBorder::horizontal_mirror(arrow_location); + arrow_location = BubbleBorder::horizontal_mirror(arrow_location); DCHECK(!bubble_border_); - bubble_border_ = new views::BubbleBorder(arrow_location); + bubble_border_ = new BubbleBorder(arrow_location); set_border(bubble_border_); - set_background(new views::BubbleBackground(bubble_border_)); + set_background(new BubbleBackground(bubble_border_)); } void BorderContents::SetBackgroundColor(SkColor color) { @@ -40,13 +38,13 @@ void BorderContents::SetBackgroundColor(SkColor color) { void BorderContents::SizeAndGetBounds( const gfx::Rect& position_relative_to, - views::BubbleBorder::ArrowLocation arrow_location, + BubbleBorder::ArrowLocation arrow_location, bool allow_bubble_offscreen, const gfx::Size& contents_size, gfx::Rect* contents_bounds, gfx::Rect* window_bounds) { if (base::i18n::IsRTL()) - arrow_location = views::BubbleBorder::horizontal_mirror(arrow_location); + arrow_location = BubbleBorder::horizontal_mirror(arrow_location); bubble_border_->set_arrow_location(arrow_location); // Set the border. set_border(bubble_border_); @@ -95,7 +93,7 @@ void BorderContents::MirrorArrowIfOffScreen( const gfx::Rect& position_relative_to, const gfx::Rect& monitor_bounds, const gfx::Size& local_contents_size, - views::BubbleBorder::ArrowLocation* arrow_location, + BubbleBorder::ArrowLocation* arrow_location, gfx::Rect* window_bounds) { // If the bounds don't fit, move the arrow to its mirrored position to see if // it improves things. @@ -103,11 +101,10 @@ void BorderContents::MirrorArrowIfOffScreen( if (ComputeOffScreenInsets(monitor_bounds, *window_bounds, &offscreen_insets) && GetInsetsLength(offscreen_insets, vertical) > 0) { - views::BubbleBorder::ArrowLocation original_arrow_location = - *arrow_location; - *arrow_location = - vertical ? views::BubbleBorder::vertical_mirror(*arrow_location) : - views::BubbleBorder::horizontal_mirror(*arrow_location); + BubbleBorder::ArrowLocation original_arrow_location = *arrow_location; + *arrow_location = + vertical ? BubbleBorder::vertical_mirror(*arrow_location) : + BubbleBorder::horizontal_mirror(*arrow_location); // Change the arrow and get the new bounds. bubble_border_->set_arrow_location(*arrow_location); diff --git a/chrome/browser/ui/views/bubble/border_contents.h b/chrome/browser/ui/views/bubble/border_contents.h index d61b847..235d8c4 100644 --- a/chrome/browser/ui/views/bubble/border_contents.h +++ b/chrome/browser/ui/views/bubble/border_contents.h @@ -6,7 +6,7 @@ #define CHROME_BROWSER_UI_VIEWS_BUBBLE_BORDER_CONTENTS_H_ #pragma once -#include "views/bubble/bubble_border.h" +#include "chrome/browser/ui/views/bubble/bubble_border.h" #include "third_party/skia/include/core/SkColor.h" #include "views/view.h" @@ -30,7 +30,7 @@ class BorderContents : public views::View { // bubble shows entirely. virtual void SizeAndGetBounds( const gfx::Rect& position_relative_to, // In screen coordinates - views::BubbleBorder::ArrowLocation arrow_location, + BubbleBorder::ArrowLocation arrow_location, bool allow_bubble_offscreen, const gfx::Size& contents_size, gfx::Rect* contents_bounds, // Returned in window coordinates @@ -53,19 +53,18 @@ class BorderContents : public views::View { return content_margins_; } - views::BubbleBorder* bubble_border_; + BubbleBorder* bubble_border_; private: // Changes |arrow_location| to its mirrored version, vertically if |vertical| // is true, horizontally otherwise, if |window_bounds| don't fit in // |monitor_bounds|. - void MirrorArrowIfOffScreen( - bool vertical, - const gfx::Rect& position_relative_to, - const gfx::Rect& monitor_bounds, - const gfx::Size& local_contents_size, - views::BubbleBorder::ArrowLocation* arrow_location, - gfx::Rect* window_bounds); + void MirrorArrowIfOffScreen(bool vertical, + const gfx::Rect& position_relative_to, + const gfx::Rect& monitor_bounds, + const gfx::Size& local_contents_size, + BubbleBorder::ArrowLocation* arrow_location, + gfx::Rect* window_bounds); // Computes how much |window_bounds| is off-screen of the monitor bounds // |monitor_bounds| and puts the values in |offscreen_insets|. diff --git a/chrome/browser/ui/views/bubble/border_contents_unittest.cc b/chrome/browser/ui/views/bubble/border_contents_unittest.cc index 1a0db0a..630064e 100644 --- a/chrome/browser/ui/views/bubble/border_contents_unittest.cc +++ b/chrome/browser/ui/views/bubble/border_contents_unittest.cc @@ -15,7 +15,7 @@ class TestBorderContents : public BorderContents { monitor_bounds_ = bounds; } - views::BubbleBorder* bubble_border() const { return bubble_border_; } + BubbleBorder* bubble_border() const { return bubble_border_; } protected: virtual gfx::Rect GetMonitorBounds(const gfx::Rect& rect) { @@ -44,16 +44,16 @@ TEST_F(BorderContentsTest, BorderContentsSizeAndGetBounds) { border_contents.set_monitor_bounds(gfx::Rect(0, 0, 1000, 1000)); border_contents.SizeAndGetBounds( gfx::Rect(100, 100, 50, 50), // |position_relative_to| - views::BubbleBorder::TOP_LEFT, + BubbleBorder::TOP_LEFT, false, // |allow_bubble_offscreen| gfx::Size(500, 500), // |contents_size| &contents_bounds, &window_bounds); // The arrow shouldn't have changed from TOP_LEFT. - views::BubbleBorder::ArrowLocation arrow_location = + BubbleBorder::ArrowLocation arrow_location = border_contents.bubble_border()->arrow_location(); - EXPECT_TRUE(views::BubbleBorder::has_arrow(arrow_location)); - EXPECT_TRUE(views::BubbleBorder::is_arrow_on_top(arrow_location)); - EXPECT_TRUE(views::BubbleBorder::is_arrow_on_left(arrow_location)); + EXPECT_TRUE(BubbleBorder::has_arrow(arrow_location)); + EXPECT_TRUE(BubbleBorder::is_arrow_on_top(arrow_location)); + EXPECT_TRUE(BubbleBorder::is_arrow_on_left(arrow_location)); EXPECT_GT(window_bounds.x(), xposition); EXPECT_GT(window_bounds.y(), 100 + 50 - 10); // -10 to roughly compensate for // arrow overlap. @@ -61,15 +61,15 @@ TEST_F(BorderContentsTest, BorderContentsSizeAndGetBounds) { // Test bubble not fitting on left. border_contents.SizeAndGetBounds( gfx::Rect(100, 100, 50, 50), // |position_relative_to| - views::BubbleBorder::TOP_RIGHT, + BubbleBorder::TOP_RIGHT, false, // |allow_bubble_offscreen| gfx::Size(500, 500), // |contents_size| &contents_bounds, &window_bounds); arrow_location = border_contents.bubble_border()->arrow_location(); // The arrow should have changed to TOP_LEFT. - EXPECT_TRUE(views::BubbleBorder::has_arrow(arrow_location)); - EXPECT_TRUE(views::BubbleBorder::is_arrow_on_top(arrow_location)); - EXPECT_TRUE(views::BubbleBorder::is_arrow_on_left(arrow_location)); + EXPECT_TRUE(BubbleBorder::has_arrow(arrow_location)); + EXPECT_TRUE(BubbleBorder::is_arrow_on_top(arrow_location)); + EXPECT_TRUE(BubbleBorder::is_arrow_on_left(arrow_location)); EXPECT_GT(window_bounds.x(), xposition); EXPECT_GT(window_bounds.y(), 100 + 50 - 10); // -10 to roughly compensate for // arrow overlap. @@ -77,15 +77,15 @@ TEST_F(BorderContentsTest, BorderContentsSizeAndGetBounds) { // Test bubble not fitting on left or top. border_contents.SizeAndGetBounds( gfx::Rect(100, 100, 50, 50), // |position_relative_to| - views::BubbleBorder::BOTTOM_RIGHT, + BubbleBorder::BOTTOM_RIGHT, false, // |allow_bubble_offscreen| gfx::Size(500, 500), // |contents_size| &contents_bounds, &window_bounds); arrow_location = border_contents.bubble_border()->arrow_location(); // The arrow should have changed to TOP_LEFT. - EXPECT_TRUE(views::BubbleBorder::has_arrow(arrow_location)); - EXPECT_TRUE(views::BubbleBorder::is_arrow_on_top(arrow_location)); - EXPECT_TRUE(views::BubbleBorder::is_arrow_on_left(arrow_location)); + EXPECT_TRUE(BubbleBorder::has_arrow(arrow_location)); + EXPECT_TRUE(BubbleBorder::is_arrow_on_top(arrow_location)); + EXPECT_TRUE(BubbleBorder::is_arrow_on_left(arrow_location)); EXPECT_GT(window_bounds.x(), xposition); EXPECT_GT(window_bounds.y(), 100 + 50 - 10); // -10 to roughly compensate for // arrow overlap. @@ -93,15 +93,15 @@ TEST_F(BorderContentsTest, BorderContentsSizeAndGetBounds) { // Test bubble not fitting on top. border_contents.SizeAndGetBounds( gfx::Rect(100, 100, 50, 50), // |position_relative_to| - views::BubbleBorder::BOTTOM_LEFT, + BubbleBorder::BOTTOM_LEFT, false, // |allow_bubble_offscreen| gfx::Size(500, 500), // |contents_size| &contents_bounds, &window_bounds); arrow_location = border_contents.bubble_border()->arrow_location(); // The arrow should have changed to TOP_LEFT. - EXPECT_TRUE(views::BubbleBorder::has_arrow(arrow_location)); - EXPECT_TRUE(views::BubbleBorder::is_arrow_on_top(arrow_location)); - EXPECT_TRUE(views::BubbleBorder::is_arrow_on_left(arrow_location)); + EXPECT_TRUE(BubbleBorder::has_arrow(arrow_location)); + EXPECT_TRUE(BubbleBorder::is_arrow_on_top(arrow_location)); + EXPECT_TRUE(BubbleBorder::is_arrow_on_left(arrow_location)); EXPECT_GT(window_bounds.x(), xposition); EXPECT_GT(window_bounds.y(), 100 + 50 - 10); // -10 to roughly compensate for // arrow overlap. @@ -109,15 +109,15 @@ TEST_F(BorderContentsTest, BorderContentsSizeAndGetBounds) { // Test bubble not fitting on top and right. border_contents.SizeAndGetBounds( gfx::Rect(900, 100, 50, 50), // |position_relative_to| - views::BubbleBorder::BOTTOM_LEFT, + BubbleBorder::BOTTOM_LEFT, false, // |allow_bubble_offscreen| gfx::Size(500, 500), // |contents_size| &contents_bounds, &window_bounds); arrow_location = border_contents.bubble_border()->arrow_location(); // The arrow should have changed to TOP_RIGHT. - EXPECT_TRUE(views::BubbleBorder::has_arrow(arrow_location)); - EXPECT_TRUE(views::BubbleBorder::is_arrow_on_top(arrow_location)); - EXPECT_FALSE(views::BubbleBorder::is_arrow_on_left(arrow_location)); + EXPECT_TRUE(BubbleBorder::has_arrow(arrow_location)); + EXPECT_TRUE(BubbleBorder::is_arrow_on_top(arrow_location)); + EXPECT_FALSE(BubbleBorder::is_arrow_on_left(arrow_location)); EXPECT_LT(window_bounds.x(), 900 + 50 - 500); EXPECT_GT(window_bounds.y(), 100 + 50 - 10); // -10 to roughly compensate for // arrow overlap. @@ -125,15 +125,15 @@ TEST_F(BorderContentsTest, BorderContentsSizeAndGetBounds) { // Test bubble not fitting on right. border_contents.SizeAndGetBounds( gfx::Rect(900, 100, 50, 50), // |position_relative_to| - views::BubbleBorder::TOP_LEFT, + BubbleBorder::TOP_LEFT, false, // |allow_bubble_offscreen| gfx::Size(500, 500), // |contents_size| &contents_bounds, &window_bounds); arrow_location = border_contents.bubble_border()->arrow_location(); // The arrow should have changed to TOP_RIGHT. - EXPECT_TRUE(views::BubbleBorder::has_arrow(arrow_location)); - EXPECT_TRUE(views::BubbleBorder::is_arrow_on_top(arrow_location)); - EXPECT_FALSE(views::BubbleBorder::is_arrow_on_left(arrow_location)); + EXPECT_TRUE(BubbleBorder::has_arrow(arrow_location)); + EXPECT_TRUE(BubbleBorder::is_arrow_on_top(arrow_location)); + EXPECT_FALSE(BubbleBorder::is_arrow_on_left(arrow_location)); EXPECT_LT(window_bounds.x(), 900 + 50 - 500); EXPECT_GT(window_bounds.y(), 100 + 50 - 10); // -10 to roughly compensate for // arrow overlap. @@ -141,15 +141,15 @@ TEST_F(BorderContentsTest, BorderContentsSizeAndGetBounds) { // Test bubble not fitting on bottom and right. border_contents.SizeAndGetBounds( gfx::Rect(900, 900, 50, 50), // |position_relative_to| - views::BubbleBorder::TOP_LEFT, + BubbleBorder::TOP_LEFT, false, // |allow_bubble_offscreen| gfx::Size(500, 500), // |contents_size| &contents_bounds, &window_bounds); arrow_location = border_contents.bubble_border()->arrow_location(); // The arrow should have changed to BOTTOM_RIGHT. - EXPECT_TRUE(views::BubbleBorder::has_arrow(arrow_location)); - EXPECT_FALSE(views::BubbleBorder::is_arrow_on_top(arrow_location)); - EXPECT_FALSE(views::BubbleBorder::is_arrow_on_left(arrow_location)); + EXPECT_TRUE(BubbleBorder::has_arrow(arrow_location)); + EXPECT_FALSE(BubbleBorder::is_arrow_on_top(arrow_location)); + EXPECT_FALSE(BubbleBorder::is_arrow_on_left(arrow_location)); EXPECT_LT(window_bounds.x(), 900 + 50 - 500); EXPECT_LT(window_bounds.y(), 900 - 500 - 15); // -15 to roughly compensate // for arrow height. @@ -157,15 +157,15 @@ TEST_F(BorderContentsTest, BorderContentsSizeAndGetBounds) { // Test bubble not fitting at the bottom. border_contents.SizeAndGetBounds( gfx::Rect(100, 900, 50, 50), // |position_relative_to| - views::BubbleBorder::TOP_LEFT, + BubbleBorder::TOP_LEFT, false, // |allow_bubble_offscreen| gfx::Size(500, 500), // |contents_size| &contents_bounds, &window_bounds); arrow_location = border_contents.bubble_border()->arrow_location(); // The arrow should have changed to BOTTOM_LEFT. - EXPECT_TRUE(views::BubbleBorder::has_arrow(arrow_location)); - EXPECT_FALSE(views::BubbleBorder::is_arrow_on_top(arrow_location)); - EXPECT_TRUE(views::BubbleBorder::is_arrow_on_left(arrow_location)); + EXPECT_TRUE(BubbleBorder::has_arrow(arrow_location)); + EXPECT_FALSE(BubbleBorder::is_arrow_on_top(arrow_location)); + EXPECT_TRUE(BubbleBorder::is_arrow_on_left(arrow_location)); // The window should be right aligned with the position_relative_to. EXPECT_LT(window_bounds.x(), 900 + 50 - 500); EXPECT_LT(window_bounds.y(), 900 - 500 - 15); // -15 to roughly compensate @@ -174,15 +174,15 @@ TEST_F(BorderContentsTest, BorderContentsSizeAndGetBounds) { // Test bubble not fitting at the bottom and left. border_contents.SizeAndGetBounds( gfx::Rect(100, 900, 50, 50), // |position_relative_to| - views::BubbleBorder::TOP_RIGHT, + BubbleBorder::TOP_RIGHT, false, // |allow_bubble_offscreen| gfx::Size(500, 500), // |contents_size| &contents_bounds, &window_bounds); arrow_location = border_contents.bubble_border()->arrow_location(); // The arrow should have changed to BOTTOM_LEFT. - EXPECT_TRUE(views::BubbleBorder::has_arrow(arrow_location)); - EXPECT_FALSE(views::BubbleBorder::is_arrow_on_top(arrow_location)); - EXPECT_TRUE(views::BubbleBorder::is_arrow_on_left(arrow_location)); + EXPECT_TRUE(BubbleBorder::has_arrow(arrow_location)); + EXPECT_FALSE(BubbleBorder::is_arrow_on_top(arrow_location)); + EXPECT_TRUE(BubbleBorder::is_arrow_on_left(arrow_location)); // The window should be right aligned with the position_relative_to. EXPECT_LT(window_bounds.x(), 900 + 50 - 500); EXPECT_LT(window_bounds.y(), 900 - 500 - 15); // -15 to roughly compensate @@ -199,18 +199,18 @@ TEST_F(BorderContentsTest, BorderContentsSizeAndGetBoundsDontMoveArrow) { border_contents.set_monitor_bounds(gfx::Rect(0, 0, 1000, 1000)); border_contents.SizeAndGetBounds( gfx::Rect(400, 100, 50, 50), // |position_relative_to| - views::BubbleBorder::TOP_LEFT, + BubbleBorder::TOP_LEFT, false, // |allow_bubble_offscreen| gfx::Size(500, 700), // |contents_size| &contents_bounds, &window_bounds); // The arrow should not have changed, as it would make it the bubble even more // offscreen. - views::BubbleBorder::ArrowLocation arrow_location = + BubbleBorder::ArrowLocation arrow_location = border_contents.bubble_border()->arrow_location(); - EXPECT_TRUE(views::BubbleBorder::has_arrow(arrow_location)); - EXPECT_TRUE(views::BubbleBorder::is_arrow_on_top(arrow_location)); - EXPECT_TRUE(views::BubbleBorder::is_arrow_on_left(arrow_location)); + EXPECT_TRUE(BubbleBorder::has_arrow(arrow_location)); + EXPECT_TRUE(BubbleBorder::is_arrow_on_top(arrow_location)); + EXPECT_TRUE(BubbleBorder::is_arrow_on_left(arrow_location)); } // Test that the 'allow offscreen' prevents the bubble from moving. @@ -222,17 +222,17 @@ TEST_F(BorderContentsTest, BorderContentsSizeAndGetBoundsAllowOffscreen) { border_contents.set_monitor_bounds(gfx::Rect(0, 0, 1000, 1000)); border_contents.SizeAndGetBounds( gfx::Rect(100, 900, 50, 50), // |position_relative_to| - views::BubbleBorder::TOP_RIGHT, + BubbleBorder::TOP_RIGHT, true, // |allow_bubble_offscreen| gfx::Size(500, 500), // |contents_size| &contents_bounds, &window_bounds); // The arrow should not have changed (eventhough the bubble does not fit). - views::BubbleBorder::ArrowLocation arrow_location = + BubbleBorder::ArrowLocation arrow_location = border_contents.bubble_border()->arrow_location(); - EXPECT_TRUE(views::BubbleBorder::has_arrow(arrow_location)); - EXPECT_TRUE(views::BubbleBorder::is_arrow_on_top(arrow_location)); - EXPECT_FALSE(views::BubbleBorder::is_arrow_on_left(arrow_location)); + EXPECT_TRUE(BubbleBorder::has_arrow(arrow_location)); + EXPECT_TRUE(BubbleBorder::is_arrow_on_top(arrow_location)); + EXPECT_FALSE(BubbleBorder::is_arrow_on_left(arrow_location)); // The coordinates should be pointing to 'positive relative to' from // TOP_RIGHT. EXPECT_LT(window_bounds.x(), 100 + 50 - 500); diff --git a/chrome/browser/ui/views/bubble/border_widget_win.cc b/chrome/browser/ui/views/bubble/border_widget_win.cc index 528de19..df5c959 100644 --- a/chrome/browser/ui/views/bubble/border_widget_win.cc +++ b/chrome/browser/ui/views/bubble/border_widget_win.cc @@ -32,7 +32,7 @@ void BorderWidgetWin::InitBorderWidgetWin(BorderContents* border_contents, gfx::Rect BorderWidgetWin::SizeAndGetBounds( const gfx::Rect& position_relative_to, - views::BubbleBorder::ArrowLocation arrow_location, + BubbleBorder::ArrowLocation arrow_location, const gfx::Size& contents_size) { // Ask the border view to calculate our bounds (and our contents'). gfx::Rect contents_bounds; diff --git a/chrome/browser/ui/views/bubble/border_widget_win.h b/chrome/browser/ui/views/bubble/border_widget_win.h index 6faff35..cbdddcc 100644 --- a/chrome/browser/ui/views/bubble/border_widget_win.h +++ b/chrome/browser/ui/views/bubble/border_widget_win.h @@ -6,7 +6,7 @@ #define CHROME_BROWSER_UI_VIEWS_BUBBLE_BORDER_WIDGET_WIN_H_ #pragma once -#include "views/bubble/bubble_border.h" +#include "chrome/browser/ui/views/bubble/bubble_border.h" #include "views/widget/native_widget_win.h" class BorderContents; @@ -30,10 +30,9 @@ class BorderWidgetWin : public views::NativeWidgetWin { // contents should use. |arrow_location| is prefered arrow location, // the function tries to preserve the location and direction, in case of RTL // arrow location is mirrored. - virtual gfx::Rect SizeAndGetBounds( - const gfx::Rect& position_relative_to, - views::BubbleBorder::ArrowLocation arrow_location, - const gfx::Size& contents_size); + virtual gfx::Rect SizeAndGetBounds(const gfx::Rect& position_relative_to, + BubbleBorder::ArrowLocation arrow_location, + const gfx::Size& contents_size); // Simple accessors. BorderContents* border_contents() { return border_contents_; } diff --git a/chrome/browser/ui/views/bubble/bubble.cc b/chrome/browser/ui/views/bubble/bubble.cc index 82ed36f..d828f8a 100644 --- a/chrome/browser/ui/views/bubble/bubble.cc +++ b/chrome/browser/ui/views/bubble/bubble.cc @@ -50,7 +50,7 @@ std::wstring BubbleDelegate::accessible_name() { // static Bubble* Bubble::Show(views::Widget* parent, const gfx::Rect& position_relative_to, - views::BubbleBorder::ArrowLocation arrow_location, + BubbleBorder::ArrowLocation arrow_location, views::View* contents, BubbleDelegate* delegate) { Bubble* bubble = new Bubble; @@ -68,7 +68,7 @@ Bubble* Bubble::Show(views::Widget* parent, Bubble* Bubble::ShowFocusless( views::Widget* parent, const gfx::Rect& position_relative_to, - views::BubbleBorder::ArrowLocation arrow_location, + BubbleBorder::ArrowLocation arrow_location, views::View* contents, BubbleDelegate* delegate, bool show_while_screen_is_locked) { @@ -144,7 +144,7 @@ Bubble::Bubble() #if defined(OS_CHROMEOS) show_while_screen_is_locked_(false), #endif - arrow_location_(views::BubbleBorder::NONE), + arrow_location_(BubbleBorder::NONE), contents_(NULL), accelerator_registered_(false) { } @@ -159,7 +159,7 @@ Bubble::Bubble(views::Widget::InitParams::Type type, fade_away_on_close_(false), type_(type), show_while_screen_is_locked_(show_while_screen_is_locked), - arrow_location_(views::BubbleBorder::NONE), + arrow_location_(BubbleBorder::NONE), contents_(NULL) { } #endif @@ -169,7 +169,7 @@ Bubble::~Bubble() { void Bubble::InitBubble(views::Widget* parent, const gfx::Rect& position_relative_to, - views::BubbleBorder::ArrowLocation arrow_location, + BubbleBorder::ArrowLocation arrow_location, views::View* contents, BubbleDelegate* delegate) { delegate_ = delegate; diff --git a/chrome/browser/ui/views/bubble/bubble.h b/chrome/browser/ui/views/bubble/bubble.h index f4f4fec..5bb6b28 100644 --- a/chrome/browser/ui/views/bubble/bubble.h +++ b/chrome/browser/ui/views/bubble/bubble.h @@ -6,7 +6,7 @@ #define CHROME_BROWSER_UI_VIEWS_BUBBLE_BUBBLE_H_ #pragma once -#include "views/bubble/bubble_border.h" +#include "chrome/browser/ui/views/bubble/bubble_border.h" #include "ui/base/animation/animation_delegate.h" #include "views/accelerator.h" #include "views/view.h" @@ -93,7 +93,7 @@ class Bubble // pressed (the default behavior). static Bubble* Show(views::Widget* parent, const gfx::Rect& position_relative_to, - views::BubbleBorder::ArrowLocation arrow_location, + BubbleBorder::ArrowLocation arrow_location, views::View* contents, BubbleDelegate* delegate); @@ -104,13 +104,12 @@ class Bubble // to achieve the focusless effect. If |show_while_screen_is_locked| is true, // a property is set telling the window manager to continue showing the bubble // even while the screen is locked. - static Bubble* ShowFocusless( - views::Widget* parent, - const gfx::Rect& position_relative_to, - views::BubbleBorder::ArrowLocation arrow_location, - views::View* contents, - BubbleDelegate* delegate, - bool show_while_screen_is_locked); + static Bubble* ShowFocusless(views::Widget* parent, + const gfx::Rect& position_relative_to, + BubbleBorder::ArrowLocation arrow_location, + views::View* contents, + BubbleDelegate* delegate, + bool show_while_screen_is_locked); #endif // Resizes and potentially moves the Bubble to best accommodate the @@ -149,7 +148,7 @@ class Bubble // Creates the Bubble. virtual void InitBubble(views::Widget* parent, const gfx::Rect& position_relative_to, - views::BubbleBorder::ArrowLocation arrow_location, + BubbleBorder::ArrowLocation arrow_location, views::View* contents, BubbleDelegate* delegate); @@ -221,7 +220,7 @@ class Bubble #endif gfx::Rect position_relative_to_; - views::BubbleBorder::ArrowLocation arrow_location_; + BubbleBorder::ArrowLocation arrow_location_; views::View* contents_; diff --git a/views/bubble/bubble_border.cc b/chrome/browser/ui/views/bubble/bubble_border.cc index 80e1bc8..9cd36d5 100644 --- a/views/bubble/bubble_border.cc +++ b/chrome/browser/ui/views/bubble/bubble_border.cc @@ -2,9 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "views/bubble/bubble_border.h" - -#include <algorithm> // for std::max +#include "chrome/browser/ui/views/bubble/bubble_border.h" #include "base/logging.h" #include "grit/ui_resources.h" @@ -14,8 +12,6 @@ #include "ui/gfx/canvas_skia.h" #include "ui/gfx/path.h" -namespace views { - // static SkBitmap* BubbleBorder::left_ = NULL; SkBitmap* BubbleBorder::top_left_ = NULL; @@ -446,5 +442,3 @@ void BubbleBackground::Paint(gfx::Canvas* canvas, views::View* view) const { path.addRoundRect(rect, radius, radius); canvas->AsCanvasSkia()->drawPath(path, paint); } - -} // namespace views diff --git a/views/bubble/bubble_border.h b/chrome/browser/ui/views/bubble/bubble_border.h index 3b88607..4082d28 100644 --- a/views/bubble/bubble_border.h +++ b/chrome/browser/ui/views/bubble/bubble_border.h @@ -1,9 +1,9 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 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. -#ifndef VIEWS_BUBBLE_BUBBLE_BORDER_H_ -#define VIEWS_BUBBLE_BUBBLE_BORDER_H_ +#ifndef CHROME_BROWSER_UI_VIEWS_BUBBLE_BORDER_H_ +#define CHROME_BROWSER_UI_VIEWS_BUBBLE_BORDER_H_ #pragma once #include "third_party/skia/include/core/SkColor.h" @@ -12,11 +12,9 @@ class SkBitmap; -namespace views { - // Renders a border, with optional arrow, and a custom dropshadow. // This can be used to produce floating "bubble" objects with rounded corners. -class VIEWS_EXPORT BubbleBorder : public views::Border { +class BubbleBorder : public views::Border { public: // Possible locations for the (optional) arrow. // 0 bit specifies left or right. @@ -171,6 +169,4 @@ class BubbleBackground : public views::Background { DISALLOW_COPY_AND_ASSIGN(BubbleBackground); }; -} // namespace views - -#endif // VIEWS_BUBBLE_BUBBLE_BORDER_H_ +#endif // CHROME_BROWSER_UI_VIEWS_BUBBLE_BORDER_H_ diff --git a/chrome/browser/ui/views/extensions/extension_installed_bubble.cc b/chrome/browser/ui/views/extensions/extension_installed_bubble.cc index 11258bc..5e0ff1e 100644 --- a/chrome/browser/ui/views/extensions/extension_installed_bubble.cc +++ b/chrome/browser/ui/views/extensions/extension_installed_bubble.cc @@ -390,8 +390,7 @@ void ExtensionInstalledBubble::ShowInternal() { views::View::ConvertPointToScreen(reference_view, &origin); gfx::Rect bounds = reference_view->bounds(); bounds.set_origin(origin); - views::BubbleBorder::ArrowLocation arrow_location = - views::BubbleBorder::TOP_RIGHT; + BubbleBorder::ArrowLocation arrow_location = BubbleBorder::TOP_RIGHT; // For omnibox keyword bubbles, move the arrow to point to the left edge // of the omnibox, just to the right of the icon. @@ -399,7 +398,7 @@ void ExtensionInstalledBubble::ShowInternal() { bounds.set_origin( browser_view->GetLocationBarView()->GetLocationEntryOrigin()); bounds.set_width(0); - arrow_location = views::BubbleBorder::TOP_LEFT; + arrow_location = BubbleBorder::TOP_LEFT; } bubble_content_ = new InstalledBubbleContent( diff --git a/chrome/browser/ui/views/extensions/extension_popup.cc b/chrome/browser/ui/views/extensions/extension_popup.cc index 28ceec6..c33cd8b 100644 --- a/chrome/browser/ui/views/extensions/extension_popup.cc +++ b/chrome/browser/ui/views/extensions/extension_popup.cc @@ -38,13 +38,12 @@ const int ExtensionPopup::kMinHeight = 25; const int ExtensionPopup::kMaxWidth = 800; const int ExtensionPopup::kMaxHeight = 600; -ExtensionPopup::ExtensionPopup( - ExtensionHost* host, - views::Widget* frame, - const gfx::Rect& relative_to, - views::BubbleBorder::ArrowLocation arrow_location, - bool inspect_with_devtools, - Observer* observer) +ExtensionPopup::ExtensionPopup(ExtensionHost* host, + views::Widget* frame, + const gfx::Rect& relative_to, + BubbleBorder::ArrowLocation arrow_location, + bool inspect_with_devtools, + Observer* observer) : BrowserBubble(host->view(), frame, relative_to, @@ -177,7 +176,7 @@ ExtensionPopup* ExtensionPopup::Show( const GURL& url, Browser* browser, const gfx::Rect& relative_to, - views::BubbleBorder::ArrowLocation arrow_location, + BubbleBorder::ArrowLocation arrow_location, bool inspect_with_devtools, Observer* observer) { ExtensionProcessManager* manager = diff --git a/chrome/browser/ui/views/extensions/extension_popup.h b/chrome/browser/ui/views/extensions/extension_popup.h index c374d7f..7f0abc3 100644 --- a/chrome/browser/ui/views/extensions/extension_popup.h +++ b/chrome/browser/ui/views/extensions/extension_popup.h @@ -9,10 +9,10 @@ #include "base/memory/ref_counted.h" #include "chrome/browser/extensions/extension_host.h" #include "chrome/browser/ui/views/browser_bubble.h" +#include "chrome/browser/ui/views/bubble/bubble_border.h" #include "chrome/browser/ui/views/extensions/extension_view.h" #include "content/common/notification_observer.h" #include "googleurl/src/gurl.h" -#include "views/bubble/bubble_border.h" class Browser; @@ -55,7 +55,7 @@ class ExtensionPopup : public BrowserBubble, // finish loading in order to minimize UI flashing and resizing. static ExtensionPopup* Show(const GURL& url, Browser* browser, const gfx::Rect& relative_to, - views::BubbleBorder::ArrowLocation arrow_location, + BubbleBorder::ArrowLocation arrow_location, bool inspect_with_devtools, Observer* observer); @@ -101,7 +101,7 @@ class ExtensionPopup : public BrowserBubble, ExtensionPopup(ExtensionHost* host, views::Widget* frame, const gfx::Rect& relative_to, - views::BubbleBorder::ArrowLocation arrow_location, + BubbleBorder::ArrowLocation arrow_location, bool inspect_with_devtools, Observer* observer); diff --git a/chrome/browser/ui/views/first_run_bubble.cc b/chrome/browser/ui/views/first_run_bubble.cc index 14428d5..637d967 100644 --- a/chrome/browser/ui/views/first_run_bubble.cc +++ b/chrome/browser/ui/views/first_run_bubble.cc @@ -479,12 +479,11 @@ void FirstRunMinimalBubbleView::FocusWillChange(View* focused_before, // FirstRunBubble ------------------------------------------------------------- // static -FirstRunBubble* FirstRunBubble::Show( - Profile* profile, - views::Widget* parent, - const gfx::Rect& position_relative_to, - views::BubbleBorder::ArrowLocation arrow_location, - FirstRun::BubbleType bubble_type) { +FirstRunBubble* FirstRunBubble::Show(Profile* profile, + views::Widget* parent, + const gfx::Rect& position_relative_to, + BubbleBorder::ArrowLocation arrow_location, + FirstRun::BubbleType bubble_type) { FirstRunBubble* bubble = new FirstRunBubble(); FirstRunBubbleViewBase* view = NULL; diff --git a/chrome/browser/ui/views/first_run_bubble.h b/chrome/browser/ui/views/first_run_bubble.h index 37b2598..15ca056 100644 --- a/chrome/browser/ui/views/first_run_bubble.h +++ b/chrome/browser/ui/views/first_run_bubble.h @@ -17,11 +17,10 @@ class Profile; class FirstRunBubble : public Bubble, public BubbleDelegate { public: - static FirstRunBubble* Show( - Profile* profile, views::Widget* parent, - const gfx::Rect& position_relative_to, - views::BubbleBorder::ArrowLocation arrow_location, - FirstRun::BubbleType bubble_type); + static FirstRunBubble* Show(Profile* profile, views::Widget* parent, + const gfx::Rect& position_relative_to, + BubbleBorder::ArrowLocation arrow_location, + FirstRun::BubbleType bubble_type); private: FirstRunBubble(); 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 990323f..3123709 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 @@ -142,8 +142,7 @@ void ContentSettingImageView::OnMouseReleased(const views::MouseEvent& event) { parent_->browser(), tab_contents, profile, content_setting_image_model_->get_content_settings_type()), profile, tab_contents->tab_contents()); - bubble_ = Bubble::Show(GetWidget(), screen_bounds, - views::BubbleBorder::TOP_RIGHT, + bubble_ = Bubble::Show(GetWidget(), screen_bounds, BubbleBorder::TOP_RIGHT, bubble_contents, this); bubble_contents->set_bubble(bubble_); } @@ -243,3 +242,4 @@ void ContentSettingImageView::AnimateToState(double state) { parent_->Layout(); parent_->SchedulePaint(); } + 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 25fa2ca..f15d5c9 100644 --- a/chrome/browser/ui/views/location_bar/location_bar_view.cc +++ b/chrome/browser/ui/views/location_bar/location_bar_view.cc @@ -52,7 +52,6 @@ #include "ui/gfx/canvas_skia.h" #include "ui/gfx/color_utils.h" #include "ui/gfx/skia_util.h" -#include "views/bubble/bubble_border.h" #include "views/controls/label.h" #include "views/controls/textfield/native_textfield_views.h" #include "views/drag_utils.h" @@ -719,8 +718,7 @@ void LocationBarView::OnPaint(gfx::Canvas* canvas) { paint.setAntiAlias(true); // The round corners of the omnibox match the round corners of the dropdown // below, and all our other bubbles. - const SkScalar radius(SkIntToScalar( - views::BubbleBorder::GetCornerRadius())); + const SkScalar radius(SkIntToScalar(BubbleBorder::GetCornerRadius())); bounds.Inset(kNormalHorizontalEdgeThickness, 0); canvas->AsCanvasSkia()->drawRoundRect(gfx::RectToSkRect(bounds), radius, radius, paint); @@ -1009,8 +1007,7 @@ void LocationBarView::ShowFirstRunBubbleInternal( origin.set_x(width() - origin.x()); views::View::ConvertPointToScreen(this, &origin); FirstRunBubble::Show(browser_->profile(), GetWidget(), - gfx::Rect(origin, gfx::Size()), - views::BubbleBorder::TOP_LEFT, bubble_type); + gfx::Rect(origin, gfx::Size()), BubbleBorder::TOP_LEFT, bubble_type); #endif } diff --git a/chrome/browser/ui/views/location_bar/page_action_image_view.cc b/chrome/browser/ui/views/location_bar/page_action_image_view.cc index 694428f..36e1761 100644 --- a/chrome/browser/ui/views/location_bar/page_action_image_view.cc +++ b/chrome/browser/ui/views/location_bar/page_action_image_view.cc @@ -75,8 +75,8 @@ void PageActionImageView::ExecuteAction(int button, View::ConvertPointToScreen(this, &origin); screen_bounds.set_origin(origin); - views::BubbleBorder::ArrowLocation arrow_location = base::i18n::IsRTL() ? - views::BubbleBorder::TOP_LEFT : views::BubbleBorder::TOP_RIGHT; + BubbleBorder::ArrowLocation arrow_location = base::i18n::IsRTL() ? + BubbleBorder::TOP_LEFT : BubbleBorder::TOP_RIGHT; popup_ = ExtensionPopup::Show( page_action_->GetPopupUrl(current_tab_id_), diff --git a/chrome/browser/ui/views/notifications/balloon_view.cc b/chrome/browser/ui/views/notifications/balloon_view.cc index 6067b42..1b8dcf5 100644 --- a/chrome/browser/ui/views/notifications/balloon_view.cc +++ b/chrome/browser/ui/views/notifications/balloon_view.cc @@ -13,6 +13,7 @@ #include "chrome/browser/notifications/desktop_notification_service.h" #include "chrome/browser/notifications/notification.h" #include "chrome/browser/notifications/notification_options_menu_model.h" +#include "chrome/browser/ui/views/bubble/bubble_border.h" #include "chrome/browser/ui/views/notifications/balloon_view_host.h" #include "chrome/common/chrome_notification_types.h" #include "content/browser/renderer_host/render_view_host.h" @@ -29,7 +30,6 @@ #include "ui/gfx/canvas_skia.h" #include "ui/gfx/insets.h" #include "ui/gfx/native_widget_types.h" -#include "views/bubble/bubble_border.h" #include "views/controls/button/button.h" #include "views/controls/button/image_button.h" #include "views/controls/button/text_button.h" @@ -104,8 +104,7 @@ BalloonViewImpl::BalloonViewImpl(BalloonCollection* collection) // as it is owned by the balloon. set_parent_owned(false); - views::BubbleBorder* bubble_border = - new views::BubbleBorder(views::BubbleBorder::FLOAT); + BubbleBorder* bubble_border = new BubbleBorder(BubbleBorder::FLOAT); set_border(bubble_border); } @@ -381,7 +380,7 @@ void BalloonViewImpl::GetContentsMask(const gfx::Rect& rect, gfx::Path* path) const { // This rounds the corners, and we also cut out a circle for the close // button, since we can't guarantee the ordering of two top-most windows. - SkScalar radius = SkIntToScalar(views::BubbleBorder::GetCornerRadius()); + SkScalar radius = SkIntToScalar(BubbleBorder::GetCornerRadius()); SkScalar spline_radius = radius - SkScalarMul(radius, (SK_ScalarSqrt2 - SK_Scalar1) * 4 / 3); SkScalar left = SkIntToScalar(0); @@ -405,7 +404,7 @@ void BalloonViewImpl::GetContentsMask(const gfx::Rect& rect, void BalloonViewImpl::GetFrameMask(const gfx::Rect& rect, gfx::Path* path) const { - SkScalar radius = SkIntToScalar(views::BubbleBorder::GetCornerRadius()); + SkScalar radius = SkIntToScalar(BubbleBorder::GetCornerRadius()); SkScalar spline_radius = radius - SkScalarMul(radius, (SK_ScalarSqrt2 - SK_Scalar1) * 4 / 3); SkScalar left = SkIntToScalar(rect.x()); diff --git a/chrome/browser/ui/views/page_info_bubble_view.cc b/chrome/browser/ui/views/page_info_bubble_view.cc index d8fbad7..067794c 100644 --- a/chrome/browser/ui/views/page_info_bubble_view.cc +++ b/chrome/browser/ui/views/page_info_bubble_view.cc @@ -499,7 +499,7 @@ void ShowPageInfoBubble(gfx::NativeWindow parent, new PageInfoBubbleView(parent, profile, url, ssl, show_history); Bubble* bubble = Bubble::Show(browser_view->GetWidget(), bounds, - views::BubbleBorder::TOP_LEFT, + BubbleBorder::TOP_LEFT, page_info_bubble, page_info_bubble); page_info_bubble->set_bubble(bubble); } diff --git a/chrome/browser/ui/views/pinned_contents_info_bubble.cc b/chrome/browser/ui/views/pinned_contents_info_bubble.cc index f1b712b..bd79c63 100644 --- a/chrome/browser/ui/views/pinned_contents_info_bubble.cc +++ b/chrome/browser/ui/views/pinned_contents_info_bubble.cc @@ -4,11 +4,11 @@ #include "chrome/browser/ui/views/pinned_contents_info_bubble.h" -#include "views/bubble/bubble_border.h" +#include "chrome/browser/ui/views/bubble/bubble_border.h" void PinnedContentsBorderContents::SizeAndGetBounds( const gfx::Rect& position_relative_to, - views::BubbleBorder::ArrowLocation arrow_location, + BubbleBorder::ArrowLocation arrow_location, bool allow_bubble_offscreen, const gfx::Size& contents_size, gfx::Rect* contents_bounds, @@ -37,7 +37,7 @@ void PinnedContentsBorderContents::SizeAndGetBounds( PinnedContentsInfoBubble* PinnedContentsInfoBubble::Show( views::Widget* parent, const gfx::Rect& position_relative_to, - views::BubbleBorder::ArrowLocation arrow_location, + BubbleBorder::ArrowLocation arrow_location, const gfx::Point& bubble_anchor, views::View* contents, BubbleDelegate* delegate) { diff --git a/chrome/browser/ui/views/pinned_contents_info_bubble.h b/chrome/browser/ui/views/pinned_contents_info_bubble.h index 381af56..2de87ab 100644 --- a/chrome/browser/ui/views/pinned_contents_info_bubble.h +++ b/chrome/browser/ui/views/pinned_contents_info_bubble.h @@ -20,7 +20,7 @@ class PinnedContentsBorderContents : public BorderContents { // BorderContents overrides: virtual void SizeAndGetBounds( const gfx::Rect& position_relative_to, // In screen coordinates - views::BubbleBorder::ArrowLocation arrow_location, + BubbleBorder::ArrowLocation arrow_location, bool allow_bubble_offscreen, const gfx::Size& contents_size, gfx::Rect* contents_bounds, // Returned in window coordinates @@ -47,7 +47,7 @@ class PinnedContentsInfoBubble : public Bubble { static PinnedContentsInfoBubble* Show( views::Widget* parent, const gfx::Rect& position_relative_to, - views::BubbleBorder::ArrowLocation arrow_location, + BubbleBorder::ArrowLocation arrow_location, const gfx::Point& bubble_anchor_, views::View* contents, BubbleDelegate* delegate); diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi index fba143d..fc6b188 100644 --- a/chrome/chrome_browser.gypi +++ b/chrome/chrome_browser.gypi @@ -3090,6 +3090,8 @@ 'browser/ui/views/bubble/border_widget_win.h', 'browser/ui/views/bubble/bubble.cc', 'browser/ui/views/bubble/bubble.h', + 'browser/ui/views/bubble/bubble_border.cc', + 'browser/ui/views/bubble/bubble_border.h', 'browser/ui/views/certificate_viewer_win.cc', 'browser/ui/views/chrome_views_delegate.cc', 'browser/ui/views/chrome_views_delegate.h', @@ -4361,6 +4363,8 @@ ['include', '^browser/ui/views/bubble/border_contents.h'], ['include', '^browser/ui/views/bubble/bubble.cc'], ['include', '^browser/ui/views/bubble/bubble.h'], + ['include', '^browser/ui/views/bubble/bubble_border.cc'], + ['include', '^browser/ui/views/bubble/bubble_border.h'], ['include', '^browser/ui/views/chrome_views_delegate.cc'], ['include', '^browser/ui/views/compact_nav/compact_location_bar_view.cc'], ['include', '^browser/ui/views/compact_nav/compact_location_bar_view.h'], @@ -1,7 +1,5 @@ include_rules = [ "+grit/ui_resources.h", - "+grit/ui_resources_standard.h", - "+grit/ui_resources_large.h", "+grit/ui_strings.h", "+skia/ext", "+net", diff --git a/views/views.gyp b/views/views.gyp index c5e5a27..7e5ca8a 100644 --- a/views/views.gyp +++ b/views/views.gyp @@ -39,7 +39,6 @@ '../ui/gfx/compositor/compositor.gyp:compositor', '../ui/ui.gyp:ui', '../ui/ui.gyp:ui_resources', - '../ui/ui.gyp:ui_resources_standard', ], 'defines': [ 'VIEWS_IMPLEMENTATION', @@ -56,8 +55,6 @@ 'background.h', 'border.cc', 'border.h', - 'bubble/bubble_border.cc', - 'bubble/bubble_border.h', 'context_menu_controller.h', 'controls/button/button.cc', 'controls/button/button.h', @@ -453,7 +450,6 @@ '../ui/base/strings/ui_strings.gyp:ui_strings', '../ui/ui.gyp:ui', '../ui/ui.gyp:ui_resources', - '../ui/ui.gyp:ui_resources_standard', 'views', ], 'include_dirs': [ @@ -491,7 +487,6 @@ 'widget/widget_unittest.cc', '<(SHARED_INTERMEDIATE_DIR)/ui/ui_resources/ui_resources.rc', - '<(SHARED_INTERMEDIATE_DIR)/ui/ui_resources_standard/ui_resources_standard.rc', ], 'conditions': [ ['toolkit_uses_gtk == 1', { @@ -552,7 +547,6 @@ '../ui/ui.gyp:ui', '../ui/ui.gyp:gfx_resources', '../ui/ui.gyp:ui_resources', - '../ui/ui.gyp:ui_resources_standard', 'views', ], 'include_dirs': [ @@ -599,7 +593,6 @@ 'test/test_views_delegate.h', '<(SHARED_INTERMEDIATE_DIR)/ui/gfx/gfx_resources.rc', '<(SHARED_INTERMEDIATE_DIR)/ui/ui_resources/ui_resources.rc', - '<(SHARED_INTERMEDIATE_DIR)/ui/ui_resources_standard/ui_resources_standard.rc', ], 'conditions': [ ['toolkit_uses_gtk == 1', { @@ -699,7 +692,6 @@ '../ui/ui.gyp:gfx_resources', '../ui/ui.gyp:ui', '../ui/ui.gyp:ui_resources', - '../ui/ui.gyp:ui_resources_standard', 'views', 'views_desktop_lib', ], @@ -712,7 +704,6 @@ 'desktop/desktop_views_delegate.h', '<(SHARED_INTERMEDIATE_DIR)/ui/gfx/gfx_resources.rc', '<(SHARED_INTERMEDIATE_DIR)/ui/ui_resources/ui_resources.rc', - '<(SHARED_INTERMEDIATE_DIR)/ui/ui_resources_standard/ui_resources_standard.rc', ], 'conditions': [ ['toolkit_uses_gtk == 1', { |