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

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

Issue 10689071: Deprecate --aura-panels (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase 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"
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 if (extension->is_platform_app()) { 99 if (extension->is_platform_app()) {
100 extensions::LaunchPlatformApp(profile, extension, command_line); 100 extensions::LaunchPlatformApp(profile, extension, command_line);
101 return NULL; 101 return NULL;
102 } 102 }
103 103
104 switch (container) { 104 switch (container) {
105 case extension_misc::LAUNCH_NONE: { 105 case extension_misc::LAUNCH_NONE: {
106 NOTREACHED(); 106 NOTREACHED();
107 break; 107 break;
108 } 108 }
109 case extension_misc::LAUNCH_PANEL: { 109 case extension_misc::LAUNCH_PANEL:
110 bool open_panel = false;
111 #if defined(USE_ASH)
112 open_panel = CommandLine::ForCurrentProcess()->HasSwitch(
113 ash::switches::kAuraPanelManager);
114 #else
115 open_panel = CommandLine::ForCurrentProcess()->HasSwitch(
116 switches::kBrowserlessPanels);
117 #endif
118 if (open_panel) {
119 tab = OpenApplicationPanel(profile, extension, override_url);
120 break;
121 }
122 // else fall through to LAUNCH_WINDOW
123 }
124 case extension_misc::LAUNCH_WINDOW: 110 case extension_misc::LAUNCH_WINDOW:
125 tab = OpenApplicationWindow(profile, extension, container, 111 tab = OpenApplicationWindow(profile, extension, container,
126 override_url, NULL); 112 override_url, NULL);
127 break; 113 break;
128 case extension_misc::LAUNCH_TAB: { 114 case extension_misc::LAUNCH_TAB: {
129 tab = OpenApplicationTab(profile, extension, override_url, 115 tab = OpenApplicationTab(profile, extension, override_url,
130 disposition); 116 disposition);
131 break; 117 break;
132 } 118 }
133 default: 119 default:
134 NOTREACHED(); 120 NOTREACHED();
135 break; 121 break;
136 } 122 }
137 return tab; 123 return tab;
138 } 124 }
139 125
140 WebContents* OpenApplicationPanel(
141 Profile* profile,
142 const Extension* extension,
143 const GURL& url_input) {
144 GURL url = UrlForExtension(extension, url_input);
145 std::string app_name =
146 web_app::GenerateApplicationNameFromExtensionId(extension->id());
147 gfx::Rect panel_bounds;
148 panel_bounds.set_width(extension->launch_width());
149 panel_bounds.set_height(extension->launch_height());
150 #if defined(USE_ASH)
151 PanelViewAura* panel_view = new PanelViewAura(app_name);
152 panel_view->Init(profile, url, panel_bounds);
153 return panel_view->WebContents();
154 #else
155 Panel* panel = PanelManager::GetInstance()->CreatePanel(
156 app_name, profile, url, panel_bounds.size());
157 panel->Show();
158 return panel->GetWebContents();
159 #endif
160 }
161
162 WebContents* OpenApplicationWindow( 126 WebContents* OpenApplicationWindow(
163 Profile* profile, 127 Profile* profile,
164 const Extension* extension, 128 const Extension* extension,
165 extension_misc::LaunchContainer container, 129 extension_misc::LaunchContainer container,
166 const GURL& url_input, 130 const GURL& url_input,
167 Browser** app_browser) { 131 Browser** app_browser) {
168 DCHECK(!url_input.is_empty() || extension); 132 DCHECK(!url_input.is_empty() || extension);
169 GURL url = UrlForExtension(extension, url_input); 133 GURL url = UrlForExtension(extension, url_input);
170 134
171 std::string app_name; 135 std::string app_name;
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 if (launch_type == ExtensionPrefs::LAUNCH_FULLSCREEN && 307 if (launch_type == ExtensionPrefs::LAUNCH_FULLSCREEN &&
344 !browser->window()->IsFullscreen()) { 308 !browser->window()->IsFullscreen()) {
345 browser->ToggleFullscreenMode(); 309 browser->ToggleFullscreenMode();
346 } 310 }
347 #endif 311 #endif
348 312
349 return contents; 313 return contents;
350 } 314 }
351 315
352 } // namespace application_launch 316 } // namespace application_launch
OLDNEW
« no previous file with comments | « chrome/browser/ui/extensions/application_launch.h ('k') | chrome/browser/ui/panels/panel_app_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698