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

Side by Side Diff: apps/launcher.cc

Issue 667723003: Prefix CommandLine usage with base namespace (Part 3: apps/) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
« no previous file with comments | « apps/app_load_service.cc ('k') | apps/load_and_launch_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 <set> 7 #include <set>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 std::string handler_id_; 305 std::string handler_id_;
306 extensions::app_file_handler_util::MimeTypeCollector collector_; 306 extensions::app_file_handler_util::MimeTypeCollector collector_;
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 base::CommandLine& command_line,
316 const base::FilePath& current_directory) { 316 const base::FilePath& current_directory) {
317 // An app with "kiosk_only" should not be installed and launched 317 // An app with "kiosk_only" should not be installed and launched
318 // outside of ChromeOS kiosk mode in the first place. This is a defensive 318 // outside of ChromeOS kiosk mode in the first place. This is a defensive
319 // check in case this scenario does occur. 319 // check in case this scenario does occur.
320 if (extensions::KioskModeInfo::IsKioskOnly(extension)) { 320 if (extensions::KioskModeInfo::IsKioskOnly(extension)) {
321 bool in_kiosk_mode = false; 321 bool in_kiosk_mode = false;
322 #if defined(OS_CHROMEOS) 322 #if defined(OS_CHROMEOS)
323 user_manager::UserManager* user_manager = user_manager::UserManager::Get(); 323 user_manager::UserManager* user_manager = user_manager::UserManager::Get();
324 in_kiosk_mode = user_manager && user_manager->IsLoggedInAsKioskApp(); 324 in_kiosk_mode = user_manager && user_manager->IsLoggedInAsKioskApp();
325 #endif 325 #endif
326 if (!in_kiosk_mode) { 326 if (!in_kiosk_mode) {
327 LOG(ERROR) << "App with 'kiosk_only' attribute must be run in " 327 LOG(ERROR) << "App with 'kiosk_only' attribute must be run in "
328 << " ChromeOS kiosk mode."; 328 << " ChromeOS kiosk mode.";
329 NOTREACHED(); 329 NOTREACHED();
330 return; 330 return;
331 } 331 }
332 } 332 }
333 333
334 #if defined(OS_WIN) 334 #if defined(OS_WIN)
335 base::CommandLine::StringType about_blank_url( 335 base::CommandLine::StringType about_blank_url(
336 base::ASCIIToWide(url::kAboutBlankURL)); 336 base::ASCIIToWide(url::kAboutBlankURL));
337 #else 337 #else
338 base::CommandLine::StringType about_blank_url(url::kAboutBlankURL); 338 base::CommandLine::StringType about_blank_url(url::kAboutBlankURL);
339 #endif 339 #endif
340 CommandLine::StringVector args = command_line.GetArgs(); 340 base::CommandLine::StringVector args = command_line.GetArgs();
341 // Browser tests will add about:blank to the command line. This should 341 // Browser tests will add about:blank to the command line. This should
342 // never be interpreted as a file to open, as doing so with an app that 342 // never be interpreted as a file to open, as doing so with an app that
343 // has write access will result in a file 'about' being created, which 343 // has write access will result in a file 'about' being created, which
344 // causes problems on the bots. 344 // causes problems on the bots.
345 if (args.empty() || (command_line.HasSwitch(switches::kTestType) && 345 if (args.empty() || (command_line.HasSwitch(switches::kTestType) &&
346 args[0] == about_blank_url)) { 346 args[0] == about_blank_url)) {
347 LaunchPlatformAppWithNoData(profile, extension); 347 LaunchPlatformAppWithNoData(profile, extension);
348 return; 348 return;
349 } 349 }
350 350
351 base::FilePath file_path(command_line.GetArgs()[0]); 351 base::FilePath file_path(command_line.GetArgs()[0]);
352 scoped_refptr<PlatformAppPathLauncher> launcher = 352 scoped_refptr<PlatformAppPathLauncher> launcher =
353 new PlatformAppPathLauncher(profile, extension, file_path); 353 new PlatformAppPathLauncher(profile, extension, file_path);
354 launcher->LaunchWithRelativePath(current_directory); 354 launcher->LaunchWithRelativePath(current_directory);
355 } 355 }
356 356
357 void LaunchPlatformAppWithPath(Profile* profile, 357 void LaunchPlatformAppWithPath(Profile* profile,
358 const Extension* extension, 358 const Extension* extension,
359 const base::FilePath& file_path) { 359 const base::FilePath& file_path) {
360 scoped_refptr<PlatformAppPathLauncher> launcher = 360 scoped_refptr<PlatformAppPathLauncher> launcher =
361 new PlatformAppPathLauncher(profile, extension, file_path); 361 new PlatformAppPathLauncher(profile, extension, file_path);
362 launcher->Launch(); 362 launcher->Launch();
363 } 363 }
364 364
365 void LaunchPlatformApp(Profile* profile, const Extension* extension) { 365 void LaunchPlatformApp(Profile* profile, const Extension* extension) {
366 LaunchPlatformAppWithCommandLine(profile, 366 LaunchPlatformAppWithCommandLine(profile,
367 extension, 367 extension,
368 CommandLine(CommandLine::NO_PROGRAM), 368 base::CommandLine(
369 base::CommandLine::NO_PROGRAM),
369 base::FilePath()); 370 base::FilePath());
370 } 371 }
371 372
372 void LaunchPlatformAppWithFileHandler( 373 void LaunchPlatformAppWithFileHandler(
373 Profile* profile, 374 Profile* profile,
374 const Extension* extension, 375 const Extension* extension,
375 const std::string& handler_id, 376 const std::string& handler_id,
376 const std::vector<base::FilePath>& file_paths) { 377 const std::vector<base::FilePath>& file_paths) {
377 scoped_refptr<PlatformAppPathLauncher> launcher = 378 scoped_refptr<PlatformAppPathLauncher> launcher =
378 new PlatformAppPathLauncher(profile, extension, file_paths); 379 new PlatformAppPathLauncher(profile, extension, file_paths);
(...skipping 26 matching lines...) Expand all
405 void LaunchPlatformAppWithUrl(Profile* profile, 406 void LaunchPlatformAppWithUrl(Profile* profile,
406 const Extension* extension, 407 const Extension* extension,
407 const std::string& handler_id, 408 const std::string& handler_id,
408 const GURL& url, 409 const GURL& url,
409 const GURL& referrer_url) { 410 const GURL& referrer_url) {
410 AppRuntimeEventRouter::DispatchOnLaunchedEventWithUrl( 411 AppRuntimeEventRouter::DispatchOnLaunchedEventWithUrl(
411 profile, extension, handler_id, url, referrer_url); 412 profile, extension, handler_id, url, referrer_url);
412 } 413 }
413 414
414 } // namespace apps 415 } // namespace apps
OLDNEW
« no previous file with comments | « apps/app_load_service.cc ('k') | apps/load_and_launch_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698