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

Side by Side Diff: apps/launcher.cc

Issue 1129063011: Extract LazyBackgroundTaskQueue from ExtensionSystem. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased from master Created 5 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
« no previous file with comments | « no previous file | chrome/browser/chromeos/file_manager/file_browser_handlers.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 10 matching lines...) Expand all
21 #include "content/public/browser/browser_thread.h" 21 #include "content/public/browser/browser_thread.h"
22 #include "content/public/browser/render_process_host.h" 22 #include "content/public/browser/render_process_host.h"
23 #include "content/public/browser/web_contents.h" 23 #include "content/public/browser/web_contents.h"
24 #include "content/public/common/content_switches.h" 24 #include "content/public/common/content_switches.h"
25 #include "content/public/common/url_constants.h" 25 #include "content/public/common/url_constants.h"
26 #include "extensions/browser/api/app_runtime/app_runtime_api.h" 26 #include "extensions/browser/api/app_runtime/app_runtime_api.h"
27 #include "extensions/browser/event_router.h" 27 #include "extensions/browser/event_router.h"
28 #include "extensions/browser/extension_host.h" 28 #include "extensions/browser/extension_host.h"
29 #include "extensions/browser/extension_prefs.h" 29 #include "extensions/browser/extension_prefs.h"
30 #include "extensions/browser/extension_registry.h" 30 #include "extensions/browser/extension_registry.h"
31 #include "extensions/browser/extension_system.h"
32 #include "extensions/browser/granted_file_entry.h" 31 #include "extensions/browser/granted_file_entry.h"
33 #include "extensions/browser/lazy_background_task_queue.h" 32 #include "extensions/browser/lazy_background_task_queue.h"
34 #include "extensions/browser/process_manager.h" 33 #include "extensions/browser/process_manager.h"
35 #include "extensions/common/api/app_runtime.h" 34 #include "extensions/common/api/app_runtime.h"
36 #include "extensions/common/extension.h" 35 #include "extensions/common/extension.h"
37 #include "extensions/common/manifest_handlers/kiosk_mode_info.h" 36 #include "extensions/common/manifest_handlers/kiosk_mode_info.h"
38 #include "net/base/filename_util.h" 37 #include "net/base/filename_util.h"
39 #include "net/base/net_util.h" 38 #include "net/base/net_util.h"
40 #include "url/gurl.h" 39 #include "url/gurl.h"
41 40
42 #if defined(OS_CHROMEOS) 41 #if defined(OS_CHROMEOS)
43 #include "components/user_manager/user_manager.h" 42 #include "components/user_manager/user_manager.h"
44 #endif 43 #endif
45 44
46 namespace app_runtime = extensions::core_api::app_runtime; 45 namespace app_runtime = extensions::core_api::app_runtime;
47 46
48 using content::BrowserThread; 47 using content::BrowserThread;
49 using extensions::AppRuntimeEventRouter; 48 using extensions::AppRuntimeEventRouter;
50 using extensions::app_file_handler_util::CreateFileEntry; 49 using extensions::app_file_handler_util::CreateFileEntry;
51 using extensions::app_file_handler_util::FileHandlerCanHandleFile; 50 using extensions::app_file_handler_util::FileHandlerCanHandleFile;
52 using extensions::app_file_handler_util::FileHandlerForId; 51 using extensions::app_file_handler_util::FileHandlerForId;
53 using extensions::app_file_handler_util::FirstFileHandlerForFile; 52 using extensions::app_file_handler_util::FirstFileHandlerForFile;
54 using extensions::app_file_handler_util::HasFileSystemWritePermission; 53 using extensions::app_file_handler_util::HasFileSystemWritePermission;
55 using extensions::app_file_handler_util::PrepareFilesForWritableApp; 54 using extensions::app_file_handler_util::PrepareFilesForWritableApp;
56 using extensions::EventRouter; 55 using extensions::EventRouter;
57 using extensions::Extension; 56 using extensions::Extension;
58 using extensions::ExtensionHost; 57 using extensions::ExtensionHost;
59 using extensions::ExtensionSystem;
60 using extensions::GrantedFileEntry; 58 using extensions::GrantedFileEntry;
61 59
62 namespace apps { 60 namespace apps {
63 61
64 namespace { 62 namespace {
65 63
66 const char kFallbackMimeType[] = "application/octet-stream"; 64 const char kFallbackMimeType[] = "application/octet-stream";
67 65
68 bool DoMakePathAbsolute(const base::FilePath& current_directory, 66 bool DoMakePathAbsolute(const base::FilePath& current_directory,
69 base::FilePath* file_path) { 67 base::FilePath* file_path) {
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 252
255 if (handler_id_.empty()) 253 if (handler_id_.empty())
256 handler_id_ = handler->id; 254 handler_id_ = handler->id;
257 255
258 // Access needs to be granted to the file for the process associated with 256 // Access needs to be granted to the file for the process associated with
259 // the extension. To do this the ExtensionHost is needed. This might not be 257 // the extension. To do this the ExtensionHost is needed. This might not be
260 // available, or it might be in the process of being unloaded, in which case 258 // available, or it might be in the process of being unloaded, in which case
261 // the lazy background task queue is used to load the extension and then 259 // the lazy background task queue is used to load the extension and then
262 // call back to us. 260 // call back to us.
263 extensions::LazyBackgroundTaskQueue* const queue = 261 extensions::LazyBackgroundTaskQueue* const queue =
264 ExtensionSystem::Get(profile_)->lazy_background_task_queue(); 262 extensions::LazyBackgroundTaskQueue::Get(profile_);
265 if (queue->ShouldEnqueueTask(profile_, extension)) { 263 if (queue->ShouldEnqueueTask(profile_, extension)) {
266 queue->AddPendingTask( 264 queue->AddPendingTask(
267 profile_, extension_id, 265 profile_, extension_id,
268 base::Bind(&PlatformAppPathLauncher::GrantAccessToFilesAndLaunch, 266 base::Bind(&PlatformAppPathLauncher::GrantAccessToFilesAndLaunch,
269 this)); 267 this));
270 return; 268 return;
271 } 269 }
272 270
273 extensions::ProcessManager* const process_manager = 271 extensions::ProcessManager* const process_manager =
274 extensions::ProcessManager::Get(profile_); 272 extensions::ProcessManager::Get(profile_);
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 void LaunchPlatformAppWithUrl(Profile* profile, 423 void LaunchPlatformAppWithUrl(Profile* profile,
426 const Extension* extension, 424 const Extension* extension,
427 const std::string& handler_id, 425 const std::string& handler_id,
428 const GURL& url, 426 const GURL& url,
429 const GURL& referrer_url) { 427 const GURL& referrer_url) {
430 AppRuntimeEventRouter::DispatchOnLaunchedEventWithUrl( 428 AppRuntimeEventRouter::DispatchOnLaunchedEventWithUrl(
431 profile, extension, handler_id, url, referrer_url); 429 profile, extension, handler_id, url, referrer_url);
432 } 430 }
433 431
434 } // namespace apps 432 } // namespace apps
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/file_manager/file_browser_handlers.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698