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

Side by Side Diff: chrome/browser/extensions/platform_app_launcher.cc

Issue 15947007: Move application restart and relaunch code out of ExtensionService. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Pafooey Created 7 years, 6 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/extensions/platform_app_launcher.h" 5 #include "chrome/browser/extensions/platform_app_launcher.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 // The path to be passed through to the app. 273 // The path to be passed through to the app.
274 const base::FilePath file_path_; 274 const base::FilePath file_path_;
275 // The ID of the file handler used to launch the app. 275 // The ID of the file handler used to launch the app.
276 std::string handler_id_; 276 std::string handler_id_;
277 277
278 DISALLOW_COPY_AND_ASSIGN(PlatformAppPathLauncher); 278 DISALLOW_COPY_AND_ASSIGN(PlatformAppPathLauncher);
279 }; 279 };
280 280
281 } // namespace 281 } // namespace
282 282
283 void LaunchPlatformApp(Profile* profile, 283 void LaunchPlatformAppWithCommandLine(Profile* profile,
284 const Extension* extension, 284 const Extension* extension,
285 const CommandLine* command_line, 285 const CommandLine* command_line,
286 const base::FilePath& current_directory) { 286 const base::FilePath& current_directory) {
287 #if defined(OS_WIN) 287 #if defined(OS_WIN)
288 // On Windows 8's single window Metro mode we can not launch platform apps. 288 // On Windows 8's single window Metro mode we can not launch platform apps.
289 // Offer to switch Chrome to desktop mode. 289 // Offer to switch Chrome to desktop mode.
290 if (win8::IsSingleWindowMetroMode()) { 290 if (win8::IsSingleWindowMetroMode()) {
291 chrome::AppMetroInfoBarDelegateWin::Create( 291 chrome::AppMetroInfoBarDelegateWin::Create(
292 profile, 292 profile,
293 chrome::AppMetroInfoBarDelegateWin::LAUNCH_PACKAGED_APP, 293 chrome::AppMetroInfoBarDelegateWin::LAUNCH_PACKAGED_APP,
294 extension->id()); 294 extension->id());
295 return; 295 return;
296 } 296 }
(...skipping 13 matching lines...) Expand all
310 const Extension* extension, 310 const Extension* extension,
311 const base::FilePath& file_path) { 311 const base::FilePath& file_path) {
312 // launcher will be freed when nothing has a reference to it. The message 312 // launcher will be freed when nothing has a reference to it. The message
313 // queue will retain a reference for any outstanding task, so when the 313 // queue will retain a reference for any outstanding task, so when the
314 // launcher has finished it will be freed. 314 // launcher has finished it will be freed.
315 scoped_refptr<PlatformAppPathLauncher> launcher = 315 scoped_refptr<PlatformAppPathLauncher> launcher =
316 new PlatformAppPathLauncher(profile, extension, file_path); 316 new PlatformAppPathLauncher(profile, extension, file_path);
317 launcher->Launch(); 317 launcher->Launch();
318 } 318 }
319 319
320 void LaunchPlatformApp(Profile* profile, const Extension* extension) {
321 LaunchPlatformAppWithCommandLine(profile, extension, NULL, base::FilePath());
322 }
323
320 void LaunchPlatformAppWithFileHandler(Profile* profile, 324 void LaunchPlatformAppWithFileHandler(Profile* profile,
321 const Extension* extension, 325 const Extension* extension,
322 const std::string& handler_id, 326 const std::string& handler_id,
323 const base::FilePath& file_path) { 327 const base::FilePath& file_path) {
324 scoped_refptr<PlatformAppPathLauncher> launcher = 328 scoped_refptr<PlatformAppPathLauncher> launcher =
325 new PlatformAppPathLauncher(profile, extension, file_path); 329 new PlatformAppPathLauncher(profile, extension, file_path);
326 launcher->LaunchWithHandler(handler_id); 330 launcher->LaunchWithHandler(handler_id);
327 } 331 }
328 332
329 void RestartPlatformApp(Profile* profile, const Extension* extension) { 333 void RestartPlatformApp(Profile* profile, const Extension* extension) {
(...skipping 12 matching lines...) Expand all
342 bool had_windows = extension_prefs->HasWindows(extension->id()); 346 bool had_windows = extension_prefs->HasWindows(extension->id());
343 extension_prefs->SetHasWindows(extension->id(), false); 347 extension_prefs->SetHasWindows(extension->id(), false);
344 bool listening_to_launch = event_router-> 348 bool listening_to_launch = event_router->
345 ExtensionHasEventListener(extension->id(), event_names::kOnLaunched); 349 ExtensionHasEventListener(extension->id(), event_names::kOnLaunched);
346 350
347 if (listening_to_launch && had_windows) 351 if (listening_to_launch && had_windows)
348 LaunchPlatformAppWithNoData(profile, extension); 352 LaunchPlatformAppWithNoData(profile, extension);
349 } 353 }
350 354
351 } // namespace extensions 355 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/platform_app_launcher.h ('k') | chrome/browser/extensions/unpacked_installer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698