diff options
Diffstat (limited to 'chrome/browser/ui')
-rw-r--r-- | chrome/browser/ui/cocoa/browser_window_cocoa.mm | 3 | ||||
-rw-r--r-- | chrome/browser/ui/cocoa/page_info_bubble_controller.h | 11 | ||||
-rw-r--r-- | chrome/browser/ui/cocoa/page_info_bubble_controller.mm | 21 | ||||
-rw-r--r-- | chrome/browser/ui/cocoa/page_info_bubble_controller_unittest.mm | 8 | ||||
-rw-r--r-- | chrome/browser/ui/gtk/browser_window_gtk.cc | 3 | ||||
-rw-r--r-- | chrome/browser/ui/gtk/page_info_bubble_gtk.cc | 26 | ||||
-rw-r--r-- | chrome/browser/ui/page_info_bubble.h | 4 | ||||
-rw-r--r-- | chrome/browser/ui/views/browser_dialogs.h | 4 | ||||
-rw-r--r-- | chrome/browser/ui/views/frame/browser_view.cc | 2 | ||||
-rw-r--r-- | chrome/browser/ui/views/page_info_bubble_view.cc | 26 | ||||
-rw-r--r-- | chrome/browser/ui/views/page_info_bubble_view.h | 7 |
11 files changed, 79 insertions, 36 deletions
diff --git a/chrome/browser/ui/cocoa/browser_window_cocoa.mm b/chrome/browser/ui/cocoa/browser_window_cocoa.mm index c0bf3ce..344aadc 100644 --- a/chrome/browser/ui/cocoa/browser_window_cocoa.mm +++ b/chrome/browser/ui/cocoa/browser_window_cocoa.mm @@ -501,7 +501,8 @@ void BrowserWindowCocoa::ShowPageInfo(Profile* profile, const GURL& url, const SSLStatus& ssl, bool show_history) { - browser::ShowPageInfoBubble(window(), profile, url, ssl, show_history); + browser::ShowPageInfoBubble(window(), profile, url, ssl, show_history, + browser_); } void BrowserWindowCocoa::ShowWebsiteSettings( diff --git a/chrome/browser/ui/cocoa/page_info_bubble_controller.h b/chrome/browser/ui/cocoa/page_info_bubble_controller.h index 6af903b..42bfe21 100644 --- a/chrome/browser/ui/cocoa/page_info_bubble_controller.h +++ b/chrome/browser/ui/cocoa/page_info_bubble_controller.h @@ -11,6 +11,10 @@ class PageInfoModel; class PageInfoModelObserver; +namespace content { +class PageNavigator; +} + // This NSWindowController subclass manages the InfoBubbleWindow and view that // are displayed when the user clicks the security lock icon. @interface PageInfoBubbleController : BaseBubbleController { @@ -23,6 +27,9 @@ class PageInfoModelObserver; // The certificate ID for the page, 0 if the page is not over HTTPS. int certID_; + + // Used for loading pages. + content::PageNavigator* navigator_; } @property(nonatomic, assign) int certID; @@ -33,7 +40,9 @@ class PageInfoModelObserver; // cannot be nil. - (id)initWithPageInfoModel:(PageInfoModel*)model modelObserver:(PageInfoModelObserver*)bridge - parentWindow:(NSWindow*)parentWindow; + parentWindow:(NSWindow*)parentWindow + navigator:(content::PageNavigator*)navigator; + // Shows the certificate display window. Note that this will implicitly close // the bubble because the certificate window will become key. The certificate diff --git a/chrome/browser/ui/cocoa/page_info_bubble_controller.mm b/chrome/browser/ui/cocoa/page_info_bubble_controller.mm index 3771869..24f6493 100644 --- a/chrome/browser/ui/cocoa/page_info_bubble_controller.mm +++ b/chrome/browser/ui/cocoa/page_info_bubble_controller.mm @@ -21,6 +21,7 @@ #import "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h" #include "chrome/common/url_constants.h" #include "content/public/browser/cert_store.h" +#include "content/public/browser/page_navigator.h" #include "content/public/common/ssl_status.h" #include "grit/generated_resources.h" #include "grit/locale_settings.h" @@ -158,14 +159,16 @@ void ShowPageInfoBubble(gfx::NativeWindow parent, Profile* profile, const GURL& url, const SSLStatus& ssl, - bool show_history) { + bool show_history, + content::PageNavigator* navigator) { PageInfoModelBubbleBridge* bridge = new PageInfoModelBubbleBridge(); PageInfoModel* model = new PageInfoModel(profile, url, ssl, show_history, bridge); PageInfoBubbleController* controller = [[PageInfoBubbleController alloc] initWithPageInfoModel:model modelObserver:bridge - parentWindow:parent]; + parentWindow:parent + navigator:navigator]; bridge->set_controller(controller); [controller setCertID:ssl.cert_id]; [controller showWindow:nil]; @@ -179,7 +182,8 @@ void ShowPageInfoBubble(gfx::NativeWindow parent, - (id)initWithPageInfoModel:(PageInfoModel*)model modelObserver:(PageInfoModelObserver*)bridge - parentWindow:(NSWindow*)parentWindow { + parentWindow:(NSWindow*)parentWindow + navigator:(content::PageNavigator*)navigator { DCHECK(parentWindow); // Use an arbitrary height because it will be changed by the bridge. @@ -196,6 +200,7 @@ void ShowPageInfoBubble(gfx::NativeWindow parent, anchoredAt:NSZeroPoint])) { model_.reset(model); bridge_.reset(bridge); + navigator_ = navigator; [[self bubble] setArrowLocation:info_bubble::kTopLeft]; [self performLayout]; } @@ -212,11 +217,11 @@ void ShowPageInfoBubble(gfx::NativeWindow parent, } - (IBAction)showHelpPage:(id)sender { - Browser* browser = BrowserList::GetLastActive(); - OpenURLParams params( - GURL(chrome::kPageInfoHelpCenterURL), Referrer(), NEW_FOREGROUND_TAB, - content::PAGE_TRANSITION_LINK, false); - browser->OpenURL(params); + navigator_->OpenURL(OpenURLParams(GURL(chrome::kPageInfoHelpCenterURL), + Referrer(), + NEW_FOREGROUND_TAB, + content::PAGE_TRANSITION_LINK, + false)); } // This will create the subviews for the page info window. The general layout diff --git a/chrome/browser/ui/cocoa/page_info_bubble_controller_unittest.mm b/chrome/browser/ui/cocoa/page_info_bubble_controller_unittest.mm index e3b42c9..8e05e4b 100644 --- a/chrome/browser/ui/cocoa/page_info_bubble_controller_unittest.mm +++ b/chrome/browser/ui/cocoa/page_info_bubble_controller_unittest.mm @@ -51,9 +51,11 @@ class PageInfoBubbleControllerTest : public CocoaTest { void CreateBubble() { // The controller cleans up after itself when the window closes. controller_ = - [[PageInfoBubbleController alloc] initWithPageInfoModel:model_ - modelObserver:NULL - parentWindow:test_window()]; + [[PageInfoBubbleController alloc] + initWithPageInfoModel:model_ + modelObserver:NULL + parentWindow:test_window() + navigator:NULL]; window_ = [controller_ window]; [controller_ showWindow:nil]; } diff --git a/chrome/browser/ui/gtk/browser_window_gtk.cc b/chrome/browser/ui/gtk/browser_window_gtk.cc index b355ad1..fba3756 100644 --- a/chrome/browser/ui/gtk/browser_window_gtk.cc +++ b/chrome/browser/ui/gtk/browser_window_gtk.cc @@ -1131,7 +1131,8 @@ void BrowserWindowGtk::ShowPageInfo(Profile* profile, const GURL& url, const SSLStatus& ssl, bool show_history) { - browser::ShowPageInfoBubble(window_, profile, url, ssl, show_history); + browser::ShowPageInfoBubble(window_, profile, url, ssl, show_history, + browser_.get()); } void BrowserWindowGtk::ShowWebsiteSettings( diff --git a/chrome/browser/ui/gtk/page_info_bubble_gtk.cc b/chrome/browser/ui/gtk/page_info_bubble_gtk.cc index 6460c16..7f748ec 100644 --- a/chrome/browser/ui/gtk/page_info_bubble_gtk.cc +++ b/chrome/browser/ui/gtk/page_info_bubble_gtk.cc @@ -40,7 +40,8 @@ class PageInfoBubbleGtk : public PageInfoModelObserver, Profile* profile, const GURL& url, const SSLStatus& ssl, - bool show_history); + bool show_history, + content::PageNavigator* navigator); virtual ~PageInfoBubbleGtk(); // PageInfoModelObserver implementation. @@ -85,6 +86,9 @@ class PageInfoBubbleGtk : public PageInfoModelObserver, Profile* profile_; + // Used for loading pages. + content::PageNavigator* navigator_; + DISALLOW_COPY_AND_ASSIGN(PageInfoBubbleGtk); }; @@ -92,7 +96,8 @@ PageInfoBubbleGtk::PageInfoBubbleGtk(gfx::NativeWindow parent, Profile* profile, const GURL& url, const SSLStatus& ssl, - bool show_history) + bool show_history, + content::PageNavigator* navigator) : ALLOW_THIS_IN_INITIALIZER_LIST(model_(profile, url, ssl, show_history, this)), url_(url), @@ -100,7 +105,8 @@ PageInfoBubbleGtk::PageInfoBubbleGtk(gfx::NativeWindow parent, parent_(parent), contents_(NULL), theme_service_(GtkThemeService::GetFrom(profile)), - profile_(profile) { + profile_(profile), + navigator_(navigator) { BrowserWindowGtk* browser_window = BrowserWindowGtk::GetBrowserWindowForNativeWindow(parent); @@ -228,10 +234,11 @@ void PageInfoBubbleGtk::OnViewCertLinkClicked(GtkWidget* widget) { } void PageInfoBubbleGtk::OnHelpLinkClicked(GtkWidget* widget) { - Browser* browser = browser::FindLastActiveWithProfile(profile_); - browser->OpenURL(OpenURLParams( - GURL(chrome::kPageInfoHelpCenterURL), content::Referrer(), - NEW_FOREGROUND_TAB, content::PAGE_TRANSITION_LINK, false)); + navigator_->OpenURL(OpenURLParams(GURL(chrome::kPageInfoHelpCenterURL), + content::Referrer(), + NEW_FOREGROUND_TAB, + content::PAGE_TRANSITION_LINK, + false)); bubble_->Close(); } @@ -243,8 +250,9 @@ void ShowPageInfoBubble(gfx::NativeWindow parent, Profile* profile, const GURL& url, const SSLStatus& ssl, - bool show_history) { - new PageInfoBubbleGtk(parent, profile, url, ssl, show_history); + bool show_history, + content::PageNavigator* navigator) { + new PageInfoBubbleGtk(parent, profile, url, ssl, show_history, navigator); } } // namespace browser diff --git a/chrome/browser/ui/page_info_bubble.h b/chrome/browser/ui/page_info_bubble.h index fe23408..dc11f0f 100644 --- a/chrome/browser/ui/page_info_bubble.h +++ b/chrome/browser/ui/page_info_bubble.h @@ -12,6 +12,7 @@ class Profile; class GURL; namespace content { +class PageNavigator; struct SSLStatus; } @@ -21,7 +22,8 @@ void ShowPageInfoBubble(gfx::NativeWindow parent, Profile* profile, const GURL& url, const content::SSLStatus& ssl, - bool show_history); + bool show_history, + content::PageNavigator* navigator); } // namespace browser diff --git a/chrome/browser/ui/views/browser_dialogs.h b/chrome/browser/ui/views/browser_dialogs.h index 3a0a464..f178371 100644 --- a/chrome/browser/ui/views/browser_dialogs.h +++ b/chrome/browser/ui/views/browser_dialogs.h @@ -26,6 +26,7 @@ class TabContentsWrapper; class TemplateURL; namespace content { +class PageNavigator; struct SSLStatus; } @@ -62,7 +63,8 @@ void ShowPageInfoBubble(views::View* anchor_view, Profile* profile, const GURL& url, const content::SSLStatus& ssl, - bool show_history); + bool show_history, + content::PageNavigator* navigator); // Shows the about dialog. See AboutChromeView. views::Widget* ShowAboutChromeView(gfx::NativeWindow parent, diff --git a/chrome/browser/ui/views/frame/browser_view.cc b/chrome/browser/ui/views/frame/browser_view.cc index 7d5a2ba..6822c7d 100644 --- a/chrome/browser/ui/views/frame/browser_view.cc +++ b/chrome/browser/ui/views/frame/browser_view.cc @@ -1138,7 +1138,7 @@ void BrowserView::ShowPageInfo(Profile* profile, const SSLStatus& ssl, bool show_history) { browser::ShowPageInfoBubble(GetLocationBarView()->location_icon_view(), - profile, url, ssl, show_history); + profile, url, ssl, show_history, browser_.get()); } void BrowserView::ShowWebsiteSettings(Profile* profile, diff --git a/chrome/browser/ui/views/page_info_bubble_view.cc b/chrome/browser/ui/views/page_info_bubble_view.cc index 86c5c59..5456668 100644 --- a/chrome/browser/ui/views/page_info_bubble_view.cc +++ b/chrome/browser/ui/views/page_info_bubble_view.cc @@ -105,14 +105,16 @@ PageInfoBubbleView::PageInfoBubbleView(views::View* anchor_view, Profile* profile, const GURL& url, const SSLStatus& ssl, - bool show_history) + bool show_history, + content::PageNavigator* navigator) : BubbleDelegateView(anchor_view, views::BubbleBorder::TOP_LEFT), ALLOW_THIS_IN_INITIALIZER_LIST(model_(profile, url, ssl, show_history, this)), cert_id_(ssl.cert_id), help_center_link_(NULL), ALLOW_THIS_IN_INITIALIZER_LIST(resize_animation_(this)), - animation_start_height_(0) { + animation_start_height_(0), + navigator_(navigator) { if (cert_id_ > 0) { scoped_refptr<net::X509Certificate> cert; @@ -282,11 +284,11 @@ gfx::Rect PageInfoBubbleView::GetAnchorRect() { } void PageInfoBubbleView::LinkClicked(views::Link* source, int event_flags) { - Browser* browser = BrowserList::GetLastActive(); - OpenURLParams params( - GURL(chrome::kPageInfoHelpCenterURL), Referrer(), NEW_FOREGROUND_TAB, - content::PAGE_TRANSITION_LINK, false); - browser->OpenURL(params); + navigator_->OpenURL(OpenURLParams(GURL(chrome::kPageInfoHelpCenterURL), + Referrer(), + NEW_FOREGROUND_TAB, + content::PAGE_TRANSITION_LINK, + false)); // NOTE: The bubble closes automatically on deactivation as the link opens. } @@ -452,9 +454,15 @@ void ShowPageInfoBubble(views::View* anchor_view, Profile* profile, const GURL& url, const SSLStatus& ssl, - bool show_history) { + bool show_history, + content::PageNavigator* navigator) { PageInfoBubbleView* page_info_bubble = - new PageInfoBubbleView(anchor_view, profile, url, ssl, show_history); + new PageInfoBubbleView(anchor_view, + profile, + url, + ssl, + show_history, + navigator); views::BubbleDelegateView::CreateBubble(page_info_bubble); page_info_bubble->Show(); } diff --git a/chrome/browser/ui/views/page_info_bubble_view.h b/chrome/browser/ui/views/page_info_bubble_view.h index d84d404..12788fc 100644 --- a/chrome/browser/ui/views/page_info_bubble_view.h +++ b/chrome/browser/ui/views/page_info_bubble_view.h @@ -14,6 +14,7 @@ #include "ui/views/controls/link_listener.h" namespace content { +class PageNavigator; struct SSLStatus; } @@ -25,7 +26,8 @@ class PageInfoBubbleView : public views::BubbleDelegateView, Profile* profile, const GURL& url, const content::SSLStatus& ssl, - bool show_history); + bool show_history, + content::PageNavigator* navigator); virtual ~PageInfoBubbleView(); // Show the certificate dialog. @@ -75,6 +77,9 @@ class PageInfoBubbleView : public views::BubbleDelegateView, // The height of the info bubble at the start of the resize animation. int animation_start_height_; + // Used for loading pages. + content::PageNavigator* navigator_; + DISALLOW_COPY_AND_ASSIGN(PageInfoBubbleView); }; |