Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(233)

Side by Side Diff: chrome/browser/ui/extensions/application_launch.cc

Issue 10897034: First part of PAGE_TRANSITION_START_PAGE cleanup. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/extensions/application_launch.h" 5 #include "chrome/browser/ui/extensions/application_launch.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/metrics/field_trial.h" 8 #include "base/metrics/field_trial.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "chrome/browser/extensions/default_apps_trial.h" 10 #include "chrome/browser/extensions/default_apps_trial.h"
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 params.initial_show_state = ui::SHOW_STATE_NORMAL; 103 params.initial_show_state = ui::SHOW_STATE_NORMAL;
104 } 104 }
105 #endif 105 #endif
106 106
107 Browser* browser = new Browser(params); 107 Browser* browser = new Browser(params);
108 108
109 if (app_browser) 109 if (app_browser)
110 *app_browser = browser; 110 *app_browser = browser;
111 111
112 TabContents* tab_contents = chrome::AddSelectedTabWithURL( 112 TabContents* tab_contents = chrome::AddSelectedTabWithURL(
113 browser, url, content::PAGE_TRANSITION_START_PAGE); 113 browser, url, content::PAGE_TRANSITION_AUTO_TOPLEVEL);
114 WebContents* contents = tab_contents->web_contents(); 114 WebContents* contents = tab_contents->web_contents();
115 contents->GetMutableRendererPrefs()->can_accept_load_drops = false; 115 contents->GetMutableRendererPrefs()->can_accept_load_drops = false;
116 contents->GetRenderViewHost()->SyncRendererPrefs(); 116 contents->GetRenderViewHost()->SyncRendererPrefs();
117 117
118 browser->window()->Show(); 118 browser->window()->Show();
119 119
120 // TODO(jcampan): http://crbug.com/8123 we should not need to set the initial 120 // TODO(jcampan): http://crbug.com/8123 we should not need to set the initial
121 // focus explicitly. 121 // focus explicitly.
122 contents->GetView()->SetInitialFocus(); 122 contents->GetView()->SetInitialFocus();
123 return contents; 123 return contents;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 } 159 }
160 160
161 int add_type = TabStripModel::ADD_ACTIVE; 161 int add_type = TabStripModel::ADD_ACTIVE;
162 if (launch_type == ExtensionPrefs::LAUNCH_PINNED) 162 if (launch_type == ExtensionPrefs::LAUNCH_PINNED)
163 add_type |= TabStripModel::ADD_PINNED; 163 add_type |= TabStripModel::ADD_PINNED;
164 164
165 GURL extension_url = UrlForExtension(extension, override_url); 165 GURL extension_url = UrlForExtension(extension, override_url);
166 // TODO(erikkay): START_PAGE doesn't seem like the right transition in all 166 // TODO(erikkay): START_PAGE doesn't seem like the right transition in all
167 // cases. 167 // cases.
168 chrome::NavigateParams params(browser, extension_url, 168 chrome::NavigateParams params(browser, extension_url,
169 content::PAGE_TRANSITION_START_PAGE); 169 content::PAGE_TRANSITION_AUTO_TOPLEVEL);
170 params.tabstrip_add_types = add_type; 170 params.tabstrip_add_types = add_type;
171 params.disposition = disposition; 171 params.disposition = disposition;
172 172
173 if (disposition == CURRENT_TAB) { 173 if (disposition == CURRENT_TAB) {
174 WebContents* existing_tab = chrome::GetActiveWebContents(browser); 174 WebContents* existing_tab = chrome::GetActiveWebContents(browser);
175 TabStripModel* model = browser->tab_strip_model(); 175 TabStripModel* model = browser->tab_strip_model();
176 int tab_index = model->GetIndexOfWebContents(existing_tab); 176 int tab_index = model->GetIndexOfWebContents(existing_tab);
177 177
178 existing_tab->OpenURL(content::OpenURLParams( 178 existing_tab->OpenURL(content::OpenURLParams(
179 extension_url, 179 extension_url,
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 // OnDidGetApplicationInfo, which calls 289 // OnDidGetApplicationInfo, which calls
290 // web_app::UpdateShortcutForTabContents when it sees UPDATE_SHORTCUT as 290 // web_app::UpdateShortcutForTabContents when it sees UPDATE_SHORTCUT as
291 // pending web app action. 291 // pending web app action.
292 tab_contents->extension_tab_helper()->set_pending_web_app_action( 292 tab_contents->extension_tab_helper()->set_pending_web_app_action(
293 extensions::TabHelper::UPDATE_SHORTCUT); 293 extensions::TabHelper::UPDATE_SHORTCUT);
294 294
295 return tab; 295 return tab;
296 } 296 }
297 297
298 } // namespace application_launch 298 } // namespace application_launch
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/web_intent_picker_cocoa.mm ('k') | chrome/browser/ui/find_bar/find_bar_host_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698