| Index: chrome/browser/ui/browser_navigator.cc
|
| diff --git a/chrome/browser/ui/browser_navigator.cc b/chrome/browser/ui/browser_navigator.cc
|
| index 1f60c7a16f2820200a192574fb1820b7e500a50b..816f1d774a0349ed9946ed8467e0660eb63c959b 100644
|
| --- a/chrome/browser/ui/browser_navigator.cc
|
| +++ b/chrome/browser/ui/browser_navigator.cc
|
| @@ -102,7 +102,8 @@ bool AdjustNavigateParamsForURL(chrome::NavigateParams* params) {
|
|
|
| Profile* profile = params->initiating_profile;
|
|
|
| - if (profile->IsOffTheRecord() || params->disposition == OFF_THE_RECORD) {
|
| + if (profile->IsOffTheRecord() ||
|
| + params->disposition == WindowOpenDisposition::OFF_THE_RECORD) {
|
| profile = profile->GetOriginalProfile();
|
|
|
| // If incognito is forced, we punt.
|
| @@ -112,7 +113,7 @@ bool AdjustNavigateParamsForURL(chrome::NavigateParams* params) {
|
| return false;
|
| }
|
|
|
| - params->disposition = SINGLETON_TAB;
|
| + params->disposition = WindowOpenDisposition::SINGLETON_TAB;
|
| params->browser = GetOrCreateBrowser(profile);
|
| params->window_action = chrome::NavigateParams::SHOW_WINDOW;
|
| }
|
| @@ -136,22 +137,22 @@ Browser* GetBrowserForDisposition(chrome::NavigateParams* params) {
|
| Profile* profile = params->initiating_profile;
|
|
|
| switch (params->disposition) {
|
| - case CURRENT_TAB:
|
| + case WindowOpenDisposition::CURRENT_TAB:
|
| if (params->browser)
|
| return params->browser;
|
| // Find a compatible window and re-execute this command in it. Otherwise
|
| // re-run with NEW_WINDOW.
|
| return GetOrCreateBrowser(profile);
|
| - case SINGLETON_TAB:
|
| - case NEW_FOREGROUND_TAB:
|
| - case NEW_BACKGROUND_TAB:
|
| + case WindowOpenDisposition::SINGLETON_TAB:
|
| + case WindowOpenDisposition::NEW_FOREGROUND_TAB:
|
| + case WindowOpenDisposition::NEW_BACKGROUND_TAB:
|
| // See if we can open the tab in the window this navigator is bound to.
|
| if (params->browser && WindowCanOpenTabs(params->browser))
|
| return params->browser;
|
| // Find a compatible window and re-execute this command in it. Otherwise
|
| // re-run with NEW_WINDOW.
|
| return GetOrCreateBrowser(profile);
|
| - case NEW_POPUP: {
|
| + case WindowOpenDisposition::NEW_POPUP: {
|
| // Make a new popup window.
|
| // Coerce app-style if |source| represents an app.
|
| std::string app_name;
|
| @@ -180,16 +181,16 @@ Browser* GetBrowserForDisposition(chrome::NavigateParams* params) {
|
| return new Browser(Browser::CreateParams::CreateForApp(
|
| app_name, params->trusted_source, params->window_bounds, profile));
|
| }
|
| - case NEW_WINDOW: {
|
| + case WindowOpenDisposition::NEW_WINDOW: {
|
| // Make a new normal browser window.
|
| return new Browser(Browser::CreateParams(profile));
|
| }
|
| - case OFF_THE_RECORD:
|
| + case WindowOpenDisposition::OFF_THE_RECORD:
|
| // Make or find an incognito window.
|
| return GetOrCreateBrowser(profile->GetOffTheRecordProfile());
|
| // The following types result in no navigation.
|
| - case SAVE_TO_DISK:
|
| - case IGNORE_ACTION:
|
| + case WindowOpenDisposition::SAVE_TO_DISK:
|
| + case WindowOpenDisposition::IGNORE_ACTION:
|
| return NULL;
|
| default:
|
| NOTREACHED();
|
| @@ -202,35 +203,37 @@ Browser* GetBrowserForDisposition(chrome::NavigateParams* params) {
|
| void NormalizeDisposition(chrome::NavigateParams* params) {
|
| // Calculate the WindowOpenDisposition if necessary.
|
| if (params->browser->tab_strip_model()->empty() &&
|
| - (params->disposition == NEW_BACKGROUND_TAB ||
|
| - params->disposition == CURRENT_TAB ||
|
| - params->disposition == SINGLETON_TAB)) {
|
| - params->disposition = NEW_FOREGROUND_TAB;
|
| + (params->disposition == WindowOpenDisposition::NEW_BACKGROUND_TAB ||
|
| + params->disposition == WindowOpenDisposition::CURRENT_TAB ||
|
| + params->disposition == WindowOpenDisposition::SINGLETON_TAB)) {
|
| + params->disposition = WindowOpenDisposition::NEW_FOREGROUND_TAB;
|
| }
|
| if (params->browser->profile()->IsOffTheRecord() &&
|
| - params->disposition == OFF_THE_RECORD) {
|
| - params->disposition = NEW_FOREGROUND_TAB;
|
| + params->disposition == WindowOpenDisposition::OFF_THE_RECORD) {
|
| + params->disposition = WindowOpenDisposition::NEW_FOREGROUND_TAB;
|
| }
|
| - if (!params->source_contents && params->disposition == CURRENT_TAB)
|
| - params->disposition = NEW_FOREGROUND_TAB;
|
| + if (!params->source_contents &&
|
| + params->disposition == WindowOpenDisposition::CURRENT_TAB)
|
| + params->disposition = WindowOpenDisposition::NEW_FOREGROUND_TAB;
|
|
|
| switch (params->disposition) {
|
| - case NEW_BACKGROUND_TAB:
|
| + case WindowOpenDisposition::NEW_BACKGROUND_TAB:
|
| // Disposition trumps add types. ADD_ACTIVE is a default, so we need to
|
| // remove it if disposition implies the tab is going to open in the
|
| // background.
|
| params->tabstrip_add_types &= ~TabStripModel::ADD_ACTIVE;
|
| break;
|
|
|
| - case NEW_WINDOW:
|
| - case NEW_POPUP:
|
| + case WindowOpenDisposition::NEW_WINDOW:
|
| + case WindowOpenDisposition::NEW_POPUP: {
|
| // Code that wants to open a new window typically expects it to be shown
|
| // automatically.
|
| if (params->window_action == chrome::NavigateParams::NO_ACTION)
|
| params->window_action = chrome::NavigateParams::SHOW_WINDOW;
|
| // Fall-through.
|
| - case NEW_FOREGROUND_TAB:
|
| - case SINGLETON_TAB:
|
| + }
|
| + case WindowOpenDisposition::NEW_FOREGROUND_TAB:
|
| + case WindowOpenDisposition::SINGLETON_TAB:
|
| params->tabstrip_add_types |= TabStripModel::ADD_ACTIVE;
|
| break;
|
|
|
| @@ -286,7 +289,8 @@ class ScopedBrowserShower {
|
| } else if (params_->window_action == chrome::NavigateParams::SHOW_WINDOW) {
|
| params_->browser->window()->Show();
|
| // If a user gesture opened a popup window, focus the contents.
|
| - if (params_->user_gesture && params_->disposition == NEW_POPUP &&
|
| + if (params_->user_gesture &&
|
| + params_->disposition == WindowOpenDisposition::NEW_POPUP &&
|
| params_->target_contents) {
|
| params_->target_contents->Focus();
|
| }
|
| @@ -345,7 +349,7 @@ content::WebContents* CreateTargetContents(const chrome::NavigateParams& params,
|
| params.source_contents->GetContainerBounds().size();
|
| create_params.created_with_opener = params.created_with_opener;
|
| }
|
| - if (params.disposition == NEW_BACKGROUND_TAB)
|
| + if (params.disposition == WindowOpenDisposition::NEW_BACKGROUND_TAB)
|
| create_params.initially_hidden = true;
|
|
|
| #if defined(USE_AURA)
|
| @@ -410,9 +414,8 @@ void Navigate(NavigateParams* params) {
|
| #endif
|
|
|
| // The browser window may want to adjust the disposition.
|
| - if (params->disposition == NEW_POPUP &&
|
| - source_browser &&
|
| - source_browser->window()) {
|
| + if (params->disposition == WindowOpenDisposition::NEW_POPUP &&
|
| + source_browser && source_browser->window()) {
|
| params->disposition =
|
| source_browser->window()->GetDispositionForPopupBounds(
|
| params->window_bounds);
|
| @@ -473,7 +476,7 @@ void Navigate(NavigateParams* params) {
|
|
|
| // If we create a popup window from a non user-gesture, don't activate it.
|
| if (params->window_action == NavigateParams::SHOW_WINDOW &&
|
| - params->disposition == NEW_POPUP &&
|
| + params->disposition == WindowOpenDisposition::NEW_POPUP &&
|
| params->user_gesture == false) {
|
| params->window_action = NavigateParams::SHOW_WINDOW_INACTIVE;
|
| }
|
| @@ -506,7 +509,7 @@ void Navigate(NavigateParams* params) {
|
| // exists.
|
| if (!params->target_contents && singleton_index < 0) {
|
| DCHECK(!params->url.is_empty());
|
| - if (params->disposition != CURRENT_TAB) {
|
| + if (params->disposition != WindowOpenDisposition::CURRENT_TAB) {
|
| params->target_contents = CreateTargetContents(*params, params->url);
|
|
|
| // This function takes ownership of |params->target_contents| until it
|
| @@ -546,13 +549,14 @@ void Navigate(NavigateParams* params) {
|
| // lose focus, then make sure the focus for the source tab goes away from the
|
| // omnibox.
|
| if (params->source_contents &&
|
| - (params->disposition == NEW_FOREGROUND_TAB ||
|
| - params->disposition == NEW_WINDOW) &&
|
| + (params->disposition == WindowOpenDisposition::NEW_FOREGROUND_TAB ||
|
| + params->disposition == WindowOpenDisposition::NEW_WINDOW) &&
|
| (params->tabstrip_add_types & TabStripModel::ADD_INHERIT_OPENER))
|
| params->source_contents->Focus();
|
|
|
| if (params->source_contents == params->target_contents ||
|
| - (swapped_in_prerender && params->disposition == CURRENT_TAB)) {
|
| + (swapped_in_prerender &&
|
| + params->disposition == WindowOpenDisposition::CURRENT_TAB)) {
|
| // The navigation occurred in the source tab.
|
| params->browser->UpdateUIForNavigationInTab(
|
| params->target_contents, params->transition, params->window_action,
|
| @@ -592,7 +596,7 @@ void Navigate(NavigateParams* params) {
|
| }
|
| }
|
|
|
| - if (params->disposition != CURRENT_TAB) {
|
| + if (params->disposition != WindowOpenDisposition::CURRENT_TAB) {
|
| content::NotificationService::current()->Notify(
|
| chrome::NOTIFICATION_TAB_ADDED,
|
| content::Source<content::WebContentsDelegate>(params->browser),
|
|
|