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

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

Issue 12450014: Show an InfoBar when trying to start Packaged Apps from Metro mode. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: feedback Created 7 years, 9 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
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"
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "base/string_util.h" 12 #include "base/string_util.h"
13 #include "base/utf_string_conversions.h" 13 #include "base/utf_string_conversions.h"
14 #include "chrome/browser/extensions/api/app_runtime/app_runtime_api.h" 14 #include "chrome/browser/extensions/api/app_runtime/app_runtime_api.h"
15 #include "chrome/browser/extensions/api/file_handlers/app_file_handler_util.h" 15 #include "chrome/browser/extensions/api/file_handlers/app_file_handler_util.h"
16 #include "chrome/browser/extensions/api/file_system/file_system_api.h" 16 #include "chrome/browser/extensions/api/file_system/file_system_api.h"
17 #include "chrome/browser/extensions/extension_host.h" 17 #include "chrome/browser/extensions/extension_host.h"
18 #include "chrome/browser/extensions/extension_prefs.h" 18 #include "chrome/browser/extensions/extension_prefs.h"
19 #include "chrome/browser/extensions/extension_process_manager.h" 19 #include "chrome/browser/extensions/extension_process_manager.h"
20 #include "chrome/browser/extensions/extension_service.h" 20 #include "chrome/browser/extensions/extension_service.h"
21 #include "chrome/browser/extensions/extension_system.h" 21 #include "chrome/browser/extensions/extension_system.h"
22 #include "chrome/browser/extensions/lazy_background_task_queue.h" 22 #include "chrome/browser/extensions/lazy_background_task_queue.h"
23 #include "chrome/browser/profiles/profile.h" 23 #include "chrome/browser/profiles/profile.h"
24 #include "chrome/browser/ui/extensions/app_metro_infobar_delegate_win.h"
24 #include "chrome/common/extensions/extension.h" 25 #include "chrome/common/extensions/extension.h"
25 #include "chrome/common/extensions/extension_messages.h" 26 #include "chrome/common/extensions/extension_messages.h"
26 #include "content/public/browser/browser_thread.h" 27 #include "content/public/browser/browser_thread.h"
27 #include "content/public/browser/child_process_security_policy.h" 28 #include "content/public/browser/child_process_security_policy.h"
28 #include "content/public/browser/render_process_host.h" 29 #include "content/public/browser/render_process_host.h"
29 #include "content/public/browser/web_contents.h" 30 #include "content/public/browser/web_contents.h"
30 #include "net/base/mime_util.h" 31 #include "net/base/mime_util.h"
31 #include "net/base/net_util.h" 32 #include "net/base/net_util.h"
32 #include "webkit/fileapi/file_system_types.h" 33 #include "webkit/fileapi/file_system_types.h"
33 #include "webkit/fileapi/isolated_context.h" 34 #include "webkit/fileapi/isolated_context.h"
34 35
36 #if defined(OS_WIN)
37 #include "win8/util/win8_util.h"
38 #endif
39
35 using content::BrowserThread; 40 using content::BrowserThread;
36 using extensions::app_file_handler_util::FileHandlerForId; 41 using extensions::app_file_handler_util::FileHandlerForId;
37 using extensions::app_file_handler_util::FileHandlerCanHandleFileWithMimeType; 42 using extensions::app_file_handler_util::FileHandlerCanHandleFileWithMimeType;
38 using extensions::app_file_handler_util::FirstFileHandlerForMimeType; 43 using extensions::app_file_handler_util::FirstFileHandlerForMimeType;
39 using extensions::app_file_handler_util::CreateFileEntry; 44 using extensions::app_file_handler_util::CreateFileEntry;
40 using extensions::app_file_handler_util::GrantedFileEntry; 45 using extensions::app_file_handler_util::GrantedFileEntry;
41 using extensions::app_file_handler_util::SavedFileEntry; 46 using extensions::app_file_handler_util::SavedFileEntry;
42 47
43 namespace extensions { 48 namespace extensions {
44 49
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 313
309 std::vector<SavedFileEntry> file_entries_; 314 std::vector<SavedFileEntry> file_entries_;
310 }; 315 };
311 316
312 } // namespace 317 } // namespace
313 318
314 void LaunchPlatformApp(Profile* profile, 319 void LaunchPlatformApp(Profile* profile,
315 const Extension* extension, 320 const Extension* extension,
316 const CommandLine* command_line, 321 const CommandLine* command_line,
317 const base::FilePath& current_directory) { 322 const base::FilePath& current_directory) {
323 #if defined(OS_WIN)
324 // On Windows 8's single window Metro mode we can not launch platform apps.
325 // Offer to switch Chrome to desktop mode.
326 if (win8::IsSingleWindowMetroMode()) {
327 chrome::AppMetroInfoBarDelegateWin::Create(
328 profile,
329 chrome::AppMetroInfoBarDelegateWin::LAUNCH_PACKAGED_APP,
330 extension->id());
331 return;
332 }
333 #endif
334
318 base::FilePath path; 335 base::FilePath path;
319 if (!GetAbsolutePathFromCommandLine(command_line, current_directory, &path)) { 336 if (!GetAbsolutePathFromCommandLine(command_line, current_directory, &path)) {
320 LaunchPlatformAppWithNoData(profile, extension); 337 LaunchPlatformAppWithNoData(profile, extension);
321 return; 338 return;
322 } 339 }
323 340
324 // TODO(benwells): add a command-line argument to provide a handler ID. 341 // TODO(benwells): add a command-line argument to provide a handler ID.
325 LaunchPlatformAppWithPath(profile, extension, path); 342 LaunchPlatformAppWithPath(profile, extension, path);
326 } 343 }
327 344
(...skipping 20 matching lines...) Expand all
348 void RestartPlatformAppWithFileEntries( 365 void RestartPlatformAppWithFileEntries(
349 Profile* profile, 366 Profile* profile,
350 const Extension* extension, 367 const Extension* extension,
351 const std::vector<SavedFileEntry>& file_entries) { 368 const std::vector<SavedFileEntry>& file_entries) {
352 scoped_refptr<SavedFileEntryLauncher> launcher = new SavedFileEntryLauncher( 369 scoped_refptr<SavedFileEntryLauncher> launcher = new SavedFileEntryLauncher(
353 profile, extension, file_entries); 370 profile, extension, file_entries);
354 launcher->Launch(); 371 launcher->Launch();
355 } 372 }
356 373
357 } // namespace extensions 374 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/app/google_chrome_strings.grd ('k') | chrome/browser/ui/extensions/app_metro_infobar_delegate_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698