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

Side by Side Diff: apps/launcher.cc

Issue 226283003: Remove single-window-metro-mode code paths for the app launcher and apps. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Thought I deleted this already 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
« no previous file with comments | « apps/apps_client.h ('k') | apps/shell/browser/shell_apps_client.h » ('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"
8 #include "apps/browser/api/app_runtime/app_runtime_api.h" 7 #include "apps/browser/api/app_runtime/app_runtime_api.h"
9 #include "apps/browser/file_handler_util.h" 8 #include "apps/browser/file_handler_util.h"
10 #include "apps/common/api/app_runtime.h" 9 #include "apps/common/api/app_runtime.h"
11 #include "base/command_line.h" 10 #include "base/command_line.h"
12 #include "base/file_util.h" 11 #include "base/file_util.h"
13 #include "base/files/file_path.h" 12 #include "base/files/file_path.h"
14 #include "base/logging.h" 13 #include "base/logging.h"
15 #include "base/memory/ref_counted.h" 14 #include "base/memory/ref_counted.h"
16 #include "base/strings/string_util.h" 15 #include "base/strings/string_util.h"
17 #include "base/strings/utf_string_conversions.h" 16 #include "base/strings/utf_string_conversions.h"
(...skipping 16 matching lines...) Expand all
34 #include "net/base/net_util.h" 33 #include "net/base/net_util.h"
35 #include "url/gurl.h" 34 #include "url/gurl.h"
36 35
37 #if defined(OS_CHROMEOS) 36 #if defined(OS_CHROMEOS)
38 #include "chrome/browser/chromeos/drive/file_errors.h" 37 #include "chrome/browser/chromeos/drive/file_errors.h"
39 #include "chrome/browser/chromeos/drive/file_system_interface.h" 38 #include "chrome/browser/chromeos/drive/file_system_interface.h"
40 #include "chrome/browser/chromeos/drive/file_system_util.h" 39 #include "chrome/browser/chromeos/drive/file_system_util.h"
41 #include "chrome/browser/chromeos/login/user_manager.h" 40 #include "chrome/browser/chromeos/login/user_manager.h"
42 #endif 41 #endif
43 42
44 #if defined(OS_WIN)
45 #include "win8/util/win8_util.h"
46 #endif
47
48 namespace app_runtime = apps::api::app_runtime; 43 namespace app_runtime = apps::api::app_runtime;
49 44
50 using apps::file_handler_util::GrantedFileEntry; 45 using apps::file_handler_util::GrantedFileEntry;
51 using content::BrowserThread; 46 using content::BrowserThread;
52 using extensions::app_file_handler_util::CheckWritableFiles; 47 using extensions::app_file_handler_util::CheckWritableFiles;
53 using extensions::app_file_handler_util::FileHandlerForId; 48 using extensions::app_file_handler_util::FileHandlerForId;
54 using extensions::app_file_handler_util::FileHandlerCanHandleFile; 49 using extensions::app_file_handler_util::FileHandlerCanHandleFile;
55 using extensions::app_file_handler_util::FirstFileHandlerForFile; 50 using extensions::app_file_handler_util::FirstFileHandlerForFile;
56 using extensions::app_file_handler_util::CreateFileEntry; 51 using extensions::app_file_handler_util::CreateFileEntry;
57 using extensions::app_file_handler_util::HasFileSystemWritePermission; 52 using extensions::app_file_handler_util::HasFileSystemWritePermission;
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 303
309 DISALLOW_COPY_AND_ASSIGN(PlatformAppPathLauncher); 304 DISALLOW_COPY_AND_ASSIGN(PlatformAppPathLauncher);
310 }; 305 };
311 306
312 } // namespace 307 } // namespace
313 308
314 void LaunchPlatformAppWithCommandLine(Profile* profile, 309 void LaunchPlatformAppWithCommandLine(Profile* profile,
315 const Extension* extension, 310 const Extension* extension,
316 const CommandLine& command_line, 311 const CommandLine& command_line,
317 const base::FilePath& current_directory) { 312 const base::FilePath& current_directory) {
318 if (!AppsClient::Get()->CheckAppLaunch(profile, extension))
319 return;
320
321 // An app with "kiosk_only" should not be installed and launched 313 // An app with "kiosk_only" should not be installed and launched
322 // outside of ChromeOS kiosk mode in the first place. This is a defensive 314 // outside of ChromeOS kiosk mode in the first place. This is a defensive
323 // check in case this scenario does occur. 315 // check in case this scenario does occur.
324 if (extensions::KioskModeInfo::IsKioskOnly(extension)) { 316 if (extensions::KioskModeInfo::IsKioskOnly(extension)) {
325 bool in_kiosk_mode = false; 317 bool in_kiosk_mode = false;
326 #if defined(OS_CHROMEOS) 318 #if defined(OS_CHROMEOS)
327 chromeos::UserManager* user_manager = chromeos::UserManager::Get(); 319 chromeos::UserManager* user_manager = chromeos::UserManager::Get();
328 in_kiosk_mode = user_manager && user_manager->IsLoggedInAsKioskApp(); 320 in_kiosk_mode = user_manager && user_manager->IsLoggedInAsKioskApp();
329 #endif 321 #endif
330 if (!in_kiosk_mode) { 322 if (!in_kiosk_mode) {
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 void LaunchPlatformAppWithFileHandler(Profile* profile, 358 void LaunchPlatformAppWithFileHandler(Profile* profile,
367 const Extension* extension, 359 const Extension* extension,
368 const std::string& handler_id, 360 const std::string& handler_id,
369 const base::FilePath& file_path) { 361 const base::FilePath& file_path) {
370 scoped_refptr<PlatformAppPathLauncher> launcher = 362 scoped_refptr<PlatformAppPathLauncher> launcher =
371 new PlatformAppPathLauncher(profile, extension, file_path); 363 new PlatformAppPathLauncher(profile, extension, file_path);
372 launcher->LaunchWithHandler(handler_id); 364 launcher->LaunchWithHandler(handler_id);
373 } 365 }
374 366
375 void RestartPlatformApp(Profile* profile, const Extension* extension) { 367 void RestartPlatformApp(Profile* profile, const Extension* extension) {
376 #if defined(OS_WIN)
377 // On Windows 8's single window Metro mode we can not launch platform apps.
378 // In restart we are just making sure launch doesn't slip through.
379 if (win8::IsSingleWindowMetroMode())
380 return;
381 #endif
382 EventRouter* event_router = EventRouter::Get(profile); 368 EventRouter* event_router = EventRouter::Get(profile);
383 bool listening_to_restart = event_router-> 369 bool listening_to_restart = event_router->
384 ExtensionHasEventListener(extension->id(), 370 ExtensionHasEventListener(extension->id(),
385 app_runtime::OnRestarted::kEventName); 371 app_runtime::OnRestarted::kEventName);
386 372
387 if (listening_to_restart) { 373 if (listening_to_restart) {
388 AppEventRouter::DispatchOnRestartedEvent(profile, extension); 374 AppEventRouter::DispatchOnRestartedEvent(profile, extension);
389 return; 375 return;
390 } 376 }
391 377
(...skipping 12 matching lines...) Expand all
404 void LaunchPlatformAppWithUrl(Profile* profile, 390 void LaunchPlatformAppWithUrl(Profile* profile,
405 const Extension* extension, 391 const Extension* extension,
406 const std::string& handler_id, 392 const std::string& handler_id,
407 const GURL& url, 393 const GURL& url,
408 const GURL& referrer_url) { 394 const GURL& referrer_url) {
409 AppEventRouter::DispatchOnLaunchedEventWithUrl( 395 AppEventRouter::DispatchOnLaunchedEventWithUrl(
410 profile, extension, handler_id, url, referrer_url); 396 profile, extension, handler_id, url, referrer_url);
411 } 397 }
412 398
413 } // namespace apps 399 } // namespace apps
OLDNEW
« no previous file with comments | « apps/apps_client.h ('k') | apps/shell/browser/shell_apps_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698