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

Side by Side Diff: apps/launcher.cc

Issue 280703003: Don't ever create a file in about:blank when launching packaged apps. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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 | « no previous file | no next file » | 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/browser/api/app_runtime/app_runtime_api.h" 7 #include "apps/browser/api/app_runtime/app_runtime_api.h"
8 #include "apps/browser/file_handler_util.h" 8 #include "apps/browser/file_handler_util.h"
9 #include "apps/common/api/app_runtime.h" 9 #include "apps/common/api/app_runtime.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
11 #include "base/file_util.h" 11 #include "base/file_util.h"
12 #include "base/files/file_path.h" 12 #include "base/files/file_path.h"
13 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "base/memory/ref_counted.h" 14 #include "base/memory/ref_counted.h"
15 #include "base/strings/string_util.h" 15 #include "base/strings/string_util.h"
16 #include "base/strings/utf_string_conversions.h" 16 #include "base/strings/utf_string_conversions.h"
17 #include "chrome/browser/extensions/api/file_handlers/app_file_handler_util.h" 17 #include "chrome/browser/extensions/api/file_handlers/app_file_handler_util.h"
18 #include "chrome/browser/extensions/api/file_system/file_system_api.h" 18 #include "chrome/browser/extensions/api/file_system/file_system_api.h"
19 #include "chrome/browser/profiles/profile.h" 19 #include "chrome/browser/profiles/profile.h"
20 #include "content/public/browser/browser_thread.h" 20 #include "content/public/browser/browser_thread.h"
21 #include "content/public/browser/render_process_host.h" 21 #include "content/public/browser/render_process_host.h"
22 #include "content/public/browser/web_contents.h" 22 #include "content/public/browser/web_contents.h"
23 #include "content/public/common/url_constants.h"
23 #include "extensions/browser/event_router.h" 24 #include "extensions/browser/event_router.h"
24 #include "extensions/browser/extension_host.h" 25 #include "extensions/browser/extension_host.h"
25 #include "extensions/browser/extension_prefs.h" 26 #include "extensions/browser/extension_prefs.h"
26 #include "extensions/browser/extension_system.h" 27 #include "extensions/browser/extension_system.h"
27 #include "extensions/browser/lazy_background_task_queue.h" 28 #include "extensions/browser/lazy_background_task_queue.h"
28 #include "extensions/browser/process_manager.h" 29 #include "extensions/browser/process_manager.h"
29 #include "extensions/common/extension.h" 30 #include "extensions/common/extension.h"
30 #include "extensions/common/extension_messages.h" 31 #include "extensions/common/extension_messages.h"
31 #include "extensions/common/manifest_handlers/kiosk_mode_info.h" 32 #include "extensions/common/manifest_handlers/kiosk_mode_info.h"
32 #include "net/base/filename_util.h" 33 #include "net/base/filename_util.h"
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 in_kiosk_mode = user_manager && user_manager->IsLoggedInAsKioskApp(); 345 in_kiosk_mode = user_manager && user_manager->IsLoggedInAsKioskApp();
345 #endif 346 #endif
346 if (!in_kiosk_mode) { 347 if (!in_kiosk_mode) {
347 LOG(ERROR) << "App with 'kiosk_only' attribute must be run in " 348 LOG(ERROR) << "App with 'kiosk_only' attribute must be run in "
348 << " ChromeOS kiosk mode."; 349 << " ChromeOS kiosk mode.";
349 NOTREACHED(); 350 NOTREACHED();
350 return; 351 return;
351 } 352 }
352 } 353 }
353 354
354 if (command_line.GetArgs().empty()) { 355 #if defined(OS_WIN)
356 base::CommandLine::StringType about_blank_url(
tapted 2014/05/13 06:47:04 if you don't want the #ifdef, you could use bas
357 base::ASCIIToWide(content::kAboutBlankURL));
358 #else
359 base::CommandLine::StringType about_blank_url(content::kAboutBlankURL);
360 #endif
361 // Browser tests will add about:blank to the command line. This should
362 // never be interpreted as a file to open, as doing so with an app that
363 // has write access will result in a file 'about' being created, which
364 // causes problems on the bots.
365 if (command_line.GetArgs().empty() ||
366 command_line.GetArgs()[0] == about_blank_url) {
tapted 2014/05/13 06:47:04 Seems unfair to disallow any packaged app from ope
benwells 2014/05/13 11:41:55 Done.
355 LaunchPlatformAppWithNoData(profile, extension); 367 LaunchPlatformAppWithNoData(profile, extension);
356 return; 368 return;
357 } 369 }
358 370
359 base::FilePath file_path(command_line.GetArgs()[0]); 371 base::FilePath file_path(command_line.GetArgs()[0]);
360 scoped_refptr<PlatformAppPathLauncher> launcher = 372 scoped_refptr<PlatformAppPathLauncher> launcher =
361 new PlatformAppPathLauncher(profile, extension, file_path); 373 new PlatformAppPathLauncher(profile, extension, file_path);
362 launcher->LaunchWithRelativePath(current_directory); 374 launcher->LaunchWithRelativePath(current_directory);
363 } 375 }
364 376
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 void LaunchPlatformAppWithUrl(Profile* profile, 424 void LaunchPlatformAppWithUrl(Profile* profile,
413 const Extension* extension, 425 const Extension* extension,
414 const std::string& handler_id, 426 const std::string& handler_id,
415 const GURL& url, 427 const GURL& url,
416 const GURL& referrer_url) { 428 const GURL& referrer_url) {
417 AppEventRouter::DispatchOnLaunchedEventWithUrl( 429 AppEventRouter::DispatchOnLaunchedEventWithUrl(
418 profile, extension, handler_id, url, referrer_url); 430 profile, extension, handler_id, url, referrer_url);
419 } 431 }
420 432
421 } // namespace apps 433 } // namespace apps
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698