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

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

Issue 187443008: Elim Browser::AppType (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase and add non trusted type test Created 6 years, 8 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
« no previous file with comments | « chrome/browser/ui/chrome_pages.cc ('k') | chrome/browser/ui/settings_window_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <string> 7 #include <string>
8 8
9 #include "apps/launcher.h" 9 #include "apps/launcher.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 return ui::SHOW_STATE_DEFAULT; 183 return ui::SHOW_STATE_DEFAULT;
184 } 184 }
185 185
186 WebContents* OpenApplicationWindow(const AppLaunchParams& params) { 186 WebContents* OpenApplicationWindow(const AppLaunchParams& params) {
187 Profile* const profile = params.profile; 187 Profile* const profile = params.profile;
188 const Extension* const extension = GetExtension(params); 188 const Extension* const extension = GetExtension(params);
189 const GURL url_input = params.override_url; 189 const GURL url_input = params.override_url;
190 190
191 DCHECK(!url_input.is_empty() || extension); 191 DCHECK(!url_input.is_empty() || extension);
192 GURL url = UrlForExtension(extension, url_input); 192 GURL url = UrlForExtension(extension, url_input);
193 Browser::CreateParams browser_params( 193 std::string app_name = extension ?
194 Browser::TYPE_POPUP, profile, params.desktop_type);
195
196 browser_params.app_name = extension ?
197 web_app::GenerateApplicationNameFromExtensionId(extension->id()) : 194 web_app::GenerateApplicationNameFromExtensionId(extension->id()) :
198 web_app::GenerateApplicationNameFromURL(url); 195 web_app::GenerateApplicationNameFromURL(url);
199 196
197 gfx::Rect initial_bounds;
200 if (!params.override_bounds.IsEmpty()) { 198 if (!params.override_bounds.IsEmpty()) {
201 browser_params.initial_bounds = params.override_bounds; 199 initial_bounds = params.override_bounds;
202 } else if (extension) { 200 } else if (extension) {
203 browser_params.initial_bounds.set_width( 201 initial_bounds.set_width(
204 extensions::AppLaunchInfo::GetLaunchWidth(extension)); 202 extensions::AppLaunchInfo::GetLaunchWidth(extension));
205 browser_params.initial_bounds.set_height( 203 initial_bounds.set_height(
206 extensions::AppLaunchInfo::GetLaunchHeight(extension)); 204 extensions::AppLaunchInfo::GetLaunchHeight(extension));
207 } 205 }
208 206
207 Browser::CreateParams browser_params(
208 Browser::CreateParams::CreateForApp(
209 Browser::TYPE_TRUSTED_POPUP, app_name, initial_bounds,
210 profile, params.desktop_type));
211
209 browser_params.initial_show_state = DetermineWindowShowState(profile, 212 browser_params.initial_show_state = DetermineWindowShowState(profile,
210 params.container, 213 params.container,
211 extension); 214 extension);
212 215
213 Browser* browser = NULL; 216 Browser* browser = NULL;
214 #if defined(OS_WIN) 217 #if defined(OS_WIN)
215 // On Windows 8's single window Metro mode we don't allow multiple Chrome 218 // On Windows 8's single window Metro mode we don't allow multiple Chrome
216 // windows to be created. We instead attempt to reuse an existing Browser 219 // windows to be created. We instead attempt to reuse an existing Browser
217 // window. 220 // window.
218 if (win8::IsSingleWindowMetroMode()) 221 if (win8::IsSingleWindowMetroMode())
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
497 // up in LoadingStateChanged to schedule a GetApplicationInfo. And when 500 // up in LoadingStateChanged to schedule a GetApplicationInfo. And when
498 // the web app info is available, extensions::TabHelper notifies Browser via 501 // the web app info is available, extensions::TabHelper notifies Browser via
499 // OnDidGetApplicationInfo, which calls 502 // OnDidGetApplicationInfo, which calls
500 // web_app::UpdateShortcutForTabContents when it sees UPDATE_SHORTCUT as 503 // web_app::UpdateShortcutForTabContents when it sees UPDATE_SHORTCUT as
501 // pending web app action. 504 // pending web app action.
502 extensions::TabHelper::FromWebContents(tab)->set_pending_web_app_action( 505 extensions::TabHelper::FromWebContents(tab)->set_pending_web_app_action(
503 extensions::TabHelper::UPDATE_SHORTCUT); 506 extensions::TabHelper::UPDATE_SHORTCUT);
504 507
505 return tab; 508 return tab;
506 } 509 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/chrome_pages.cc ('k') | chrome/browser/ui/settings_window_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698