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

Side by Side Diff: apps/launcher.cc

Issue 114263005: Convert Extension* to extension id in AppLaunchParams. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix compile Created 7 years 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
« no previous file with comments | « apps/launcher.h ('k') | chrome/browser/apps/app_browsertest.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "apps/launcher.h" 5 #include "apps/launcher.h"
6 6
7 #include "apps/apps_client.h" 7 #include "apps/apps_client.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 return !file_path->empty(); 76 return !file_path->empty();
77 } 77 }
78 78
79 if (!current_directory.IsAbsolute()) 79 if (!current_directory.IsAbsolute())
80 return false; 80 return false;
81 81
82 *file_path = current_directory.Append(*file_path); 82 *file_path = current_directory.Append(*file_path);
83 return true; 83 return true;
84 } 84 }
85 85
86 bool GetAbsolutePathFromCommandLine(const CommandLine* command_line, 86 bool GetAbsolutePathFromCommandLine(const CommandLine& command_line,
87 const base::FilePath& current_directory, 87 const base::FilePath& current_directory,
88 base::FilePath* path) { 88 base::FilePath* path) {
89 if (!command_line || !command_line->GetArgs().size()) 89 if (!command_line.GetArgs().size())
90 return false; 90 return false;
91 91
92 base::FilePath relative_path(command_line->GetArgs()[0]); 92 base::FilePath relative_path(command_line.GetArgs()[0]);
93 base::FilePath absolute_path(relative_path); 93 base::FilePath absolute_path(relative_path);
94 if (!MakePathAbsolute(current_directory, &absolute_path)) { 94 if (!MakePathAbsolute(current_directory, &absolute_path)) {
95 LOG(WARNING) << "Cannot make absolute path from " << relative_path.value(); 95 LOG(WARNING) << "Cannot make absolute path from " << relative_path.value();
96 return false; 96 return false;
97 } 97 }
98 *path = absolute_path; 98 *path = absolute_path;
99 return true; 99 return true;
100 } 100 }
101 101
102 // Helper method to launch the platform app |extension| with no data. This 102 // Helper method to launch the platform app |extension| with no data. This
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 // The ID of the file handler used to launch the app. 305 // The ID of the file handler used to launch the app.
306 std::string handler_id_; 306 std::string handler_id_;
307 307
308 DISALLOW_COPY_AND_ASSIGN(PlatformAppPathLauncher); 308 DISALLOW_COPY_AND_ASSIGN(PlatformAppPathLauncher);
309 }; 309 };
310 310
311 } // namespace 311 } // namespace
312 312
313 void LaunchPlatformAppWithCommandLine(Profile* profile, 313 void LaunchPlatformAppWithCommandLine(Profile* profile,
314 const Extension* extension, 314 const Extension* extension,
315 const CommandLine* command_line, 315 const CommandLine& command_line,
316 const base::FilePath& current_directory) { 316 const base::FilePath& current_directory) {
317 if (!AppsClient::Get()->CheckAppLaunch(profile, extension)) 317 if (!AppsClient::Get()->CheckAppLaunch(profile, extension))
318 return; 318 return;
319 319
320 // An app with "kiosk_only" should not be installed and launched 320 // An app with "kiosk_only" should not be installed and launched
321 // outside of ChromeOS kiosk mode in the first place. This is a defensive 321 // outside of ChromeOS kiosk mode in the first place. This is a defensive
322 // check in case this scenario does occur. 322 // check in case this scenario does occur.
323 if (extensions::KioskModeInfo::IsKioskOnly(extension)) { 323 if (extensions::KioskModeInfo::IsKioskOnly(extension)) {
324 bool in_kiosk_mode = false; 324 bool in_kiosk_mode = false;
325 #if defined(OS_CHROMEOS) 325 #if defined(OS_CHROMEOS)
(...skipping 23 matching lines...) Expand all
349 const base::FilePath& file_path) { 349 const base::FilePath& file_path) {
350 // launcher will be freed when nothing has a reference to it. The message 350 // launcher will be freed when nothing has a reference to it. The message
351 // queue will retain a reference for any outstanding task, so when the 351 // queue will retain a reference for any outstanding task, so when the
352 // launcher has finished it will be freed. 352 // launcher has finished it will be freed.
353 scoped_refptr<PlatformAppPathLauncher> launcher = 353 scoped_refptr<PlatformAppPathLauncher> launcher =
354 new PlatformAppPathLauncher(profile, extension, file_path); 354 new PlatformAppPathLauncher(profile, extension, file_path);
355 launcher->Launch(); 355 launcher->Launch();
356 } 356 }
357 357
358 void LaunchPlatformApp(Profile* profile, const Extension* extension) { 358 void LaunchPlatformApp(Profile* profile, const Extension* extension) {
359 LaunchPlatformAppWithCommandLine(profile, extension, NULL, base::FilePath()); 359 LaunchPlatformAppWithCommandLine(profile,
360 extension,
361 CommandLine(CommandLine::NO_PROGRAM),
362 base::FilePath());
360 } 363 }
361 364
362 void LaunchPlatformAppWithFileHandler(Profile* profile, 365 void LaunchPlatformAppWithFileHandler(Profile* profile,
363 const Extension* extension, 366 const Extension* extension,
364 const std::string& handler_id, 367 const std::string& handler_id,
365 const base::FilePath& file_path) { 368 const base::FilePath& file_path) {
366 scoped_refptr<PlatformAppPathLauncher> launcher = 369 scoped_refptr<PlatformAppPathLauncher> launcher =
367 new PlatformAppPathLauncher(profile, extension, file_path); 370 new PlatformAppPathLauncher(profile, extension, file_path);
368 launcher->LaunchWithHandler(handler_id); 371 launcher->LaunchWithHandler(handler_id);
369 } 372 }
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 void LaunchPlatformAppWithUrl(Profile* profile, 404 void LaunchPlatformAppWithUrl(Profile* profile,
402 const Extension* extension, 405 const Extension* extension,
403 const std::string& handler_id, 406 const std::string& handler_id,
404 const GURL& url, 407 const GURL& url,
405 const GURL& referrer_url) { 408 const GURL& referrer_url) {
406 extensions::AppEventRouter::DispatchOnLaunchedEventWithUrl( 409 extensions::AppEventRouter::DispatchOnLaunchedEventWithUrl(
407 profile, extension, handler_id, url, referrer_url); 410 profile, extension, handler_id, url, referrer_url);
408 } 411 }
409 412
410 } // namespace apps 413 } // namespace apps
OLDNEW
« no previous file with comments | « apps/launcher.h ('k') | chrome/browser/apps/app_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698