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

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

Issue 10698068: chrome: Put browser_navigator.h into chrome namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: already in chrome namespace Created 8 years, 5 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"
11 #include "chrome/browser/extensions/extension_prefs.h" 11 #include "chrome/browser/extensions/extension_prefs.h"
12 #include "chrome/browser/extensions/extension_service.h" 12 #include "chrome/browser/extensions/extension_service.h"
13 #include "chrome/browser/extensions/extension_tab_helper.h" 13 #include "chrome/browser/extensions/extension_tab_helper.h"
14 #include "chrome/browser/extensions/platform_app_launcher.h" 14 #include "chrome/browser/extensions/platform_app_launcher.h"
15 #include "chrome/browser/profiles/profile.h" 15 #include "chrome/browser/profiles/profile.h"
16 #include "chrome/browser/ui/tab_contents/tab_contents.h"
17 #include "chrome/browser/ui/browser.h" 16 #include "chrome/browser/ui/browser.h"
18 #include "chrome/browser/ui/browser_finder.h" 17 #include "chrome/browser/ui/browser_finder.h"
19 #include "chrome/browser/ui/browser_tabstrip.h" 18 #include "chrome/browser/ui/browser_tabstrip.h"
20 #include "chrome/browser/ui/browser_window.h" 19 #include "chrome/browser/ui/browser_window.h"
21 #include "chrome/browser/ui/panels/panel_manager.h" 20 #include "chrome/browser/ui/panels/panel_manager.h"
21 #include "chrome/browser/ui/tab_contents/tab_contents.h"
22 #include "chrome/browser/ui/tabs/tab_strip_model.h" 22 #include "chrome/browser/ui/tabs/tab_strip_model.h"
23 #include "chrome/browser/web_applications/web_app.h" 23 #include "chrome/browser/web_applications/web_app.h"
24 #include "chrome/common/chrome_switches.h" 24 #include "chrome/common/chrome_switches.h"
25 #include "chrome/common/extensions/extension.h" 25 #include "chrome/common/extensions/extension.h"
26 #include "chrome/common/extensions/extension_constants.h" 26 #include "chrome/common/extensions/extension_constants.h"
27 #include "chrome/common/url_constants.h" 27 #include "chrome/common/url_constants.h"
28 #include "content/public/browser/render_view_host.h" 28 #include "content/public/browser/render_view_host.h"
29 #include "content/public/browser/web_contents.h" 29 #include "content/public/browser/web_contents.h"
30 #include "content/public/browser/web_contents_view.h" 30 #include "content/public/browser/web_contents_view.h"
31 #include "content/public/common/renderer_preferences.h" 31 #include "content/public/common/renderer_preferences.h"
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 launch_type, 100); 291 launch_type, 100);
292 } 292 }
293 293
294 int add_type = TabStripModel::ADD_ACTIVE; 294 int add_type = TabStripModel::ADD_ACTIVE;
295 if (launch_type == ExtensionPrefs::LAUNCH_PINNED) 295 if (launch_type == ExtensionPrefs::LAUNCH_PINNED)
296 add_type |= TabStripModel::ADD_PINNED; 296 add_type |= TabStripModel::ADD_PINNED;
297 297
298 GURL extension_url = UrlForExtension(extension, override_url); 298 GURL extension_url = UrlForExtension(extension, override_url);
299 // TODO(erikkay): START_PAGE doesn't seem like the right transition in all 299 // TODO(erikkay): START_PAGE doesn't seem like the right transition in all
300 // cases. 300 // cases.
301 browser::NavigateParams params(browser, extension_url, 301 chrome::NavigateParams params(browser, extension_url,
302 content::PAGE_TRANSITION_START_PAGE); 302 content::PAGE_TRANSITION_START_PAGE);
303 params.tabstrip_add_types = add_type; 303 params.tabstrip_add_types = add_type;
304 params.disposition = disposition; 304 params.disposition = disposition;
305 305
306 if (disposition == CURRENT_TAB) { 306 if (disposition == CURRENT_TAB) {
307 WebContents* existing_tab = chrome::GetActiveWebContents(browser); 307 WebContents* existing_tab = chrome::GetActiveWebContents(browser);
308 TabStripModel* model = browser->tab_strip_model(); 308 TabStripModel* model = browser->tab_strip_model();
309 int tab_index = model->GetIndexOfWebContents(existing_tab); 309 int tab_index = model->GetIndexOfWebContents(existing_tab);
310 310
311 existing_tab->OpenURL(content::OpenURLParams( 311 existing_tab->OpenURL(content::OpenURLParams(
312 extension_url, 312 extension_url,
313 content::Referrer(existing_tab->GetURL(), 313 content::Referrer(existing_tab->GetURL(),
314 WebKit::WebReferrerPolicyDefault), 314 WebKit::WebReferrerPolicyDefault),
315 disposition, content::PAGE_TRANSITION_LINK, false)); 315 disposition, content::PAGE_TRANSITION_LINK, false));
316 // Reset existing_tab as OpenURL() may have clobbered it. 316 // Reset existing_tab as OpenURL() may have clobbered it.
317 existing_tab = chrome::GetActiveWebContents(browser); 317 existing_tab = chrome::GetActiveWebContents(browser);
318 if (params.tabstrip_add_types & TabStripModel::ADD_PINNED) { 318 if (params.tabstrip_add_types & TabStripModel::ADD_PINNED) {
319 model->SetTabPinned(tab_index, true); 319 model->SetTabPinned(tab_index, true);
320 // Pinning may have moved the tab. 320 // Pinning may have moved the tab.
321 tab_index = model->GetIndexOfWebContents(existing_tab); 321 tab_index = model->GetIndexOfWebContents(existing_tab);
322 } 322 }
323 if (params.tabstrip_add_types & TabStripModel::ADD_ACTIVE) 323 if (params.tabstrip_add_types & TabStripModel::ADD_ACTIVE)
324 model->ActivateTabAt(tab_index, true); 324 model->ActivateTabAt(tab_index, true);
325 325
326 contents = existing_tab; 326 contents = existing_tab;
327 } else { 327 } else {
328 browser::Navigate(&params); 328 chrome::Navigate(&params);
329 contents = params.target_contents->web_contents(); 329 contents = params.target_contents->web_contents();
330 } 330 }
331 331
332 #if defined(USE_ASH) 332 #if defined(USE_ASH)
333 // In ash, LAUNCH_FULLSCREEN launches in a maximized app window and it should 333 // In ash, LAUNCH_FULLSCREEN launches in a maximized app window and it should
334 // not reach here. 334 // not reach here.
335 DCHECK(launch_type != ExtensionPrefs::LAUNCH_FULLSCREEN); 335 DCHECK(launch_type != ExtensionPrefs::LAUNCH_FULLSCREEN);
336 #else 336 #else
337 // TODO(skerner): If we are already in full screen mode, and the user 337 // TODO(skerner): If we are already in full screen mode, and the user
338 // set the app to open as a regular or pinned tab, what should happen? 338 // set the app to open as a regular or pinned tab, what should happen?
339 // Today we open the tab, but stay in full screen mode. Should we leave 339 // Today we open the tab, but stay in full screen mode. Should we leave
340 // full screen mode in this case? 340 // full screen mode in this case?
341 if (launch_type == ExtensionPrefs::LAUNCH_FULLSCREEN && 341 if (launch_type == ExtensionPrefs::LAUNCH_FULLSCREEN &&
342 !browser->window()->IsFullscreen()) { 342 !browser->window()->IsFullscreen()) {
343 browser->ToggleFullscreenMode(); 343 browser->ToggleFullscreenMode();
344 } 344 }
345 #endif 345 #endif
346 346
347 return contents; 347 return contents;
348 } 348 }
349 349
350 } // namespace application_launch 350 } // namespace application_launch
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm ('k') | chrome/browser/ui/gtk/tabs/tab_strip_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698