diff options
Diffstat (limited to 'chrome/browser/ui/cocoa')
13 files changed, 88 insertions, 33 deletions
diff --git a/chrome/browser/ui/cocoa/about_window_controller.mm b/chrome/browser/ui/cocoa/about_window_controller.mm index 83d5b41..f156a40 100644 --- a/chrome/browser/ui/cocoa/about_window_controller.mm +++ b/chrome/browser/ui/cocoa/about_window_controller.mm @@ -27,6 +27,9 @@ #include "ui/base/resource/resource_bundle.h" #include "ui/gfx/image/image.h" +using content::OpenURLParams; +using content::Referrer; + namespace { void AttributedStringAppendString(NSMutableAttributedString* attr_str, @@ -619,8 +622,10 @@ static BOOL recentShownUserActionFailedStatus = NO; // We always create a new window, so there's no need to try to re-use // an existing one just to pass in the NEW_WINDOW disposition. Browser* browser = Browser::Create(profile_); - browser->OpenURL(GURL([link UTF8String]), GURL(), NEW_FOREGROUND_TAB, - content::PAGE_TRANSITION_LINK); + OpenURLParams params( + GURL([link UTF8String]), Referrer(), NEW_FOREGROUND_TAB, + content::PAGE_TRANSITION_LINK, false); + browser->OpenURL(params); browser->window()->Show(); return YES; } diff --git a/chrome/browser/ui/cocoa/applescript/tab_applescript.mm b/chrome/browser/ui/cocoa/applescript/tab_applescript.mm index 748e15d..dcd8b23 100644 --- a/chrome/browser/ui/cocoa/applescript/tab_applescript.mm +++ b/chrome/browser/ui/cocoa/applescript/tab_applescript.mm @@ -26,6 +26,9 @@ #include "content/public/browser/web_contents_delegate.h" #include "googleurl/src/gurl.h" +using content::OpenURLParams; +using content::Referrer; + @interface AnyResultValue : NSObject { @private scoped_nsobject<NSAppleEventDescriptor> descriptor; @@ -390,12 +393,13 @@ static NSAppleEventDescriptor* valueToDescriptor(Value* value) { NavigationEntry* entry = tabContents_->tab_contents()->GetController().GetLastCommittedEntry(); if (entry) { - tabContents_->tab_contents()->OpenURL( + tabContents_->tab_contents()->OpenURL(OpenURLParams( GURL(chrome::kViewSourceScheme + std::string(":") + entry->GetURL().spec()), - GURL(), + Referrer(), NEW_FOREGROUND_TAB, - content::PAGE_TRANSITION_LINK); + content::PAGE_TRANSITION_LINK, + false)); } } diff --git a/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.mm b/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.mm index a77a617..40e524e 100644 --- a/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.mm +++ b/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.mm @@ -53,6 +53,8 @@ #include "ui/gfx/image/image.h" #include "ui/gfx/mac/nsimage_cache.h" +using content::OpenURLParams; +using content::Referrer; using content::UserMetricsAction; // Bookmark bar state changing and animations @@ -1109,8 +1111,10 @@ void RecordAppLaunch(Profile* profile, GURL url) { // Actually open the URL. This is the last chance for a unit test to // override. - (void)openURL:(GURL)url disposition:(WindowOpenDisposition)disposition { - browser_->OpenURL( - url, GURL(), disposition, content::PAGE_TRANSITION_AUTO_BOOKMARK); + OpenURLParams params( + url, Referrer(), disposition, content::PAGE_TRANSITION_AUTO_BOOKMARK, + false); + browser_->OpenURL(params); } - (void)clearMenuTagMap { diff --git a/chrome/browser/ui/cocoa/bookmarks/bookmark_menu_cocoa_controller.mm b/chrome/browser/ui/cocoa/bookmarks/bookmark_menu_cocoa_controller.mm index 375b78e..a402b43 100644 --- a/chrome/browser/ui/cocoa/bookmarks/bookmark_menu_cocoa_controller.mm +++ b/chrome/browser/ui/cocoa/bookmarks/bookmark_menu_cocoa_controller.mm @@ -16,6 +16,8 @@ #include "content/public/browser/user_metrics.h" #include "ui/base/text/text_elider.h" +using content::OpenURLParams; +using content::Referrer; using content::UserMetricsAction; namespace { @@ -94,8 +96,10 @@ const NSUInteger kMaximumMenuPixelsWide = 300; browser = Browser::Create(bridge_->GetProfile()); WindowOpenDisposition disposition = event_utils::WindowOpenDispositionFromNSEvent([NSApp currentEvent]); - browser->OpenURL(node->url(), GURL(), disposition, - content::PAGE_TRANSITION_AUTO_BOOKMARK); + OpenURLParams params( + node->url(), Referrer(), disposition, + content::PAGE_TRANSITION_AUTO_BOOKMARK, false); + browser->OpenURL(params); } // Open sites under BookmarkNode with the specified disposition. diff --git a/chrome/browser/ui/cocoa/browser_window_controller.mm b/chrome/browser/ui/cocoa/browser_window_controller.mm index bdc2ca8..45f205e 100644 --- a/chrome/browser/ui/cocoa/browser_window_controller.mm +++ b/chrome/browser/ui/cocoa/browser_window_controller.mm @@ -146,6 +146,8 @@ // longer indicate that the window is shrinking from an apparent zoomed state) // and if it's set we continue to constrain the resize. +using content::OpenURLParams; +using content::Referrer; using content::WebContents; @interface NSWindow (NSPrivateApis) @@ -1756,8 +1758,10 @@ enum { if (web_contents) { GURL helpUrl = google_util::AppendGoogleLocaleParam(GURL(chrome::kCrashReasonURL)); - web_contents->OpenURL( - helpUrl, GURL(), CURRENT_TAB, content::PAGE_TRANSITION_LINK); + OpenURLParams params( + helpUrl, Referrer(), CURRENT_TAB, content::PAGE_TRANSITION_LINK, + false); + web_contents->OpenURL(params); } } } diff --git a/chrome/browser/ui/cocoa/extensions/extension_action_context_menu.mm b/chrome/browser/ui/cocoa/extensions/extension_action_context_menu.mm index 702da38..dc1c730 100644 --- a/chrome/browser/ui/cocoa/extensions/extension_action_context_menu.mm +++ b/chrome/browser/ui/cocoa/extensions/extension_action_context_menu.mm @@ -35,6 +35,9 @@ #include "ui/base/l10n/l10n_util.h" #include "ui/base/l10n/l10n_util_mac.h" +using content::OpenURLParams; +using content::Referrer; + // A class that loads the extension icon on the I/O thread before showing the // confirmation dialog to uninstall the given extension. // Also acts as the extension's UI delegate in order to display the dialog. @@ -245,8 +248,10 @@ int CurrentTabId() { case kExtensionContextName: { GURL url(std::string(extension_urls::kGalleryBrowsePrefix) + std::string("/detail/") + extension_->id()); - browser->OpenURL( - url, GURL(), NEW_FOREGROUND_TAB, content::PAGE_TRANSITION_LINK); + OpenURLParams params( + url, Referrer(), NEW_FOREGROUND_TAB, content::PAGE_TRANSITION_LINK, + false); + browser->OpenURL(params); break; } case kExtensionContextOptions: { diff --git a/chrome/browser/ui/cocoa/extensions/extension_install_dialog_controller.mm b/chrome/browser/ui/cocoa/extensions/extension_install_dialog_controller.mm index c67e774..4d4aabe 100644 --- a/chrome/browser/ui/cocoa/extensions/extension_install_dialog_controller.mm +++ b/chrome/browser/ui/cocoa/extensions/extension_install_dialog_controller.mm @@ -20,6 +20,9 @@ #include "ui/base/l10n/l10n_util.h" #include "ui/base/l10n/l10n_util_mac.h" +using content::OpenURLParams; +using content::Referrer; + @interface ExtensionInstallDialogController () - (bool)isInlineInstall; - (void)appendRatingStar:(const SkBitmap*)skiaImage; @@ -124,9 +127,9 @@ void AppendRatingStarsShim(const SkBitmap* skiaImage, void* data) { - (IBAction)storeLinkClicked:(id)sender { GURL store_url( extension_urls::GetWebstoreItemDetailURLPrefix() + extension_->id()); - BrowserList::GetLastActiveWithProfile(profile_)-> - OpenURL(store_url, GURL(), NEW_FOREGROUND_TAB, - content::PAGE_TRANSITION_LINK); + BrowserList::GetLastActiveWithProfile(profile_)->OpenURL(OpenURLParams( + store_url, Referrer(), NEW_FOREGROUND_TAB, content::PAGE_TRANSITION_LINK, + false)); delegate_->InstallUIAbort(/*user_initiated=*/true); [NSApp endSheet:[self window]]; diff --git a/chrome/browser/ui/cocoa/history_menu_cocoa_controller.mm b/chrome/browser/ui/cocoa/history_menu_cocoa_controller.mm index 7fa2988..2f3a050 100644 --- a/chrome/browser/ui/cocoa/history_menu_cocoa_controller.mm +++ b/chrome/browser/ui/cocoa/history_menu_cocoa_controller.mm @@ -17,6 +17,9 @@ #include "chrome/browser/ui/cocoa/event_utils.h" #include "webkit/glue/window_open_disposition.h" +using content::OpenURLParams; +using content::Referrer; + @implementation HistoryMenuCocoaController - (id)initWithBridge:(HistoryMenuBridge*)bridge { @@ -47,8 +50,10 @@ node->session_id, UNKNOWN); } else { DCHECK(node->url.is_valid()); - browser->OpenURL(node->url, GURL(), disposition, - content::PAGE_TRANSITION_AUTO_BOOKMARK); + OpenURLParams params( + node->url, Referrer(), disposition, + content::PAGE_TRANSITION_AUTO_BOOKMARK, false); + browser->OpenURL(params); } } diff --git a/chrome/browser/ui/cocoa/page_info_bubble_controller.mm b/chrome/browser/ui/cocoa/page_info_bubble_controller.mm index 26ee5a5..39e0652 100644 --- a/chrome/browser/ui/cocoa/page_info_bubble_controller.mm +++ b/chrome/browser/ui/cocoa/page_info_bubble_controller.mm @@ -32,6 +32,8 @@ #include "ui/base/l10n/l10n_util_mac.h" #include "ui/gfx/image/image.h" +using content::OpenURLParams; +using content::Referrer; using content::SSLStatus; @interface PageInfoBubbleController (Private) @@ -214,8 +216,10 @@ void ShowPageInfoBubble(gfx::NativeWindow parent, GURL url = google_util::AppendGoogleLocaleParam( GURL(chrome::kPageInfoHelpCenterURL)); Browser* browser = BrowserList::GetLastActive(); - browser->OpenURL( - url, GURL(), NEW_FOREGROUND_TAB, content::PAGE_TRANSITION_LINK); + OpenURLParams params( + url, Referrer(), NEW_FOREGROUND_TAB, content::PAGE_TRANSITION_LINK, + false); + browser->OpenURL(params); } // This will create the subviews for the page info window. The general layout diff --git a/chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm b/chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm index 447197f..2a0bd59 100644 --- a/chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm +++ b/chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm @@ -66,6 +66,8 @@ #include "ui/gfx/image/image.h" #include "ui/gfx/mac/nsimage_cache.h" +using content::OpenURLParams; +using content::Referrer; using content::UserMetricsAction; NSString* const kTabStripNumberOfTabsChanged = @"kTabStripNumberOfTabsChanged"; @@ -1882,9 +1884,9 @@ private: } case CURRENT_TAB: content::RecordAction(UserMetricsAction("Tab_DropURLOnTab")); - tabStripModel_->GetTabContentsAt(index) - ->tab_contents()->OpenURL(*url, GURL(), CURRENT_TAB, - content::PAGE_TRANSITION_TYPED); + OpenURLParams params( + *url, Referrer(), CURRENT_TAB, content::PAGE_TRANSITION_TYPED, false); + tabStripModel_->GetTabContentsAt(index)->tab_contents()->OpenURL(params); tabStripModel_->ActivateTabAt(index, true); break; default: diff --git a/chrome/browser/ui/cocoa/toolbar/toolbar_controller.mm b/chrome/browser/ui/cocoa/toolbar/toolbar_controller.mm index a5f5f68..0affff4 100644 --- a/chrome/browser/ui/cocoa/toolbar/toolbar_controller.mm +++ b/chrome/browser/ui/cocoa/toolbar/toolbar_controller.mm @@ -61,6 +61,9 @@ #include "ui/gfx/image/image.h" #include "ui/gfx/rect.h" +using content::OpenURLParams; +using content::Referrer; + namespace { // Height of the toolbar in pixels when the bookmark bar is closed. @@ -755,8 +758,9 @@ class NotificationBridge : public content::NotificationObserver { OmniboxView::StripJavascriptSchemas(UTF8ToUTF16(url.spec()))); return; } - browser_->GetSelectedTabContents()->OpenURL(url, GURL(), CURRENT_TAB, - content::PAGE_TRANSITION_TYPED); + OpenURLParams params( + url, Referrer(), CURRENT_TAB, content::PAGE_TRANSITION_TYPED, false); + browser_->GetSelectedTabContents()->OpenURL(params); } // (URLDropTargetController protocol) @@ -771,8 +775,9 @@ class NotificationBridge : public content::NotificationObserver { base::SysNSStringToUTF16(text), string16(), false, false, &match, NULL); GURL url(match.destination_url); - browser_->GetSelectedTabContents()->OpenURL(url, GURL(), CURRENT_TAB, - content::PAGE_TRANSITION_TYPED); + OpenURLParams params( + url, Referrer(), CURRENT_TAB, content::PAGE_TRANSITION_TYPED, false); + browser_->GetSelectedTabContents()->OpenURL(params); } // (URLDropTargetController protocol) diff --git a/chrome/browser/ui/cocoa/view_id_util_browsertest.mm b/chrome/browser/ui/cocoa/view_id_util_browsertest.mm index 3cf49d4..dffc231 100644 --- a/chrome/browser/ui/cocoa/view_id_util_browsertest.mm +++ b/chrome/browser/ui/cocoa/view_id_util_browsertest.mm @@ -20,6 +20,9 @@ #include "chrome/test/base/in_process_browser_test.h" #include "chrome/test/base/ui_test_utils.h" +using content::OpenURLParams; +using content::Referrer; + // Basic sanity check of ViewID use on the mac. class ViewIDTest : public InProcessBrowserTest { public: @@ -108,15 +111,17 @@ IN_PROC_BROWSER_TEST_F(ViewIDTest, Tab) { // Open 9 new tabs. for (int i = 1; i <= 9; ++i) { CheckViewID(static_cast<ViewID>(VIEW_ID_TAB_0 + i), false); - browser()->OpenURL(GURL(chrome::kAboutBlankURL), GURL(), - NEW_BACKGROUND_TAB, content::PAGE_TRANSITION_TYPED); + browser()->OpenURL(OpenURLParams( + GURL(chrome::kAboutBlankURL), Referrer(), NEW_BACKGROUND_TAB, + content::PAGE_TRANSITION_TYPED, false)); CheckViewID(static_cast<ViewID>(VIEW_ID_TAB_0 + i), true); // VIEW_ID_TAB_LAST should always be available. CheckViewID(VIEW_ID_TAB_LAST, true); } // Open the 11th tab. - browser()->OpenURL(GURL(chrome::kAboutBlankURL), GURL(), - NEW_BACKGROUND_TAB, content::PAGE_TRANSITION_TYPED); + browser()->OpenURL(OpenURLParams( + GURL(chrome::kAboutBlankURL), Referrer(), NEW_BACKGROUND_TAB, + content::PAGE_TRANSITION_TYPED, false)); CheckViewID(VIEW_ID_TAB_LAST, true); } diff --git a/chrome/browser/ui/cocoa/web_intent_bubble_controller.mm b/chrome/browser/ui/cocoa/web_intent_bubble_controller.mm index e08cc45..c4804d1 100644 --- a/chrome/browser/ui/cocoa/web_intent_bubble_controller.mm +++ b/chrome/browser/ui/cocoa/web_intent_bubble_controller.mm @@ -21,6 +21,9 @@ #include "ui/base/resource/resource_bundle.h" #include "ui/gfx/image/image.h" +using content::OpenURLParams; +using content::Referrer; + namespace { // The width of the window, in view coordinates. The height will be @@ -112,8 +115,10 @@ const CGFloat kTextWidth = kWindowWidth - (kImageSize + kImageSpacing + - (IBAction)showChromeWebStore:(id)sender { GURL url(l10n_util::GetStringUTF8(IDS_WEBSTORE_URL)); Browser* browser = BrowserList::GetLastActive(); - browser->OpenURL(url, GURL(), NEW_FOREGROUND_TAB, - content::PAGE_TRANSITION_LINK); + OpenURLParams params( + url, Referrer(), NEW_FOREGROUND_TAB, content::PAGE_TRANSITION_LINK, + false); + browser->OpenURL(params); } // A picker button has been pressed - invoke corresponding service. |