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

Side by Side Diff: apps/app_load_service.cc

Issue 718133005: Add load-app flag support to chrome (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years, 1 month 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 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/app_load_service.h" 5 #include "apps/app_load_service.h"
6 6
7 #include "apps/app_load_service_factory.h" 7 #include "apps/app_load_service_factory.h"
8 #include "apps/app_restore_service.h" 8 #include "apps/app_restore_service.h"
9 #include "apps/launcher.h" 9 #include "apps/launcher.h"
10 #include "chrome/browser/extensions/extension_service.h" 10 #include "chrome/browser/extensions/extension_service.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 } 70 }
71 71
72 // Schedule the app to be launched once loaded. 72 // Schedule the app to be launched once loaded.
73 PostReloadAction& action = post_reload_actions_[extension_id]; 73 PostReloadAction& action = post_reload_actions_[extension_id];
74 action.action_type = LAUNCH_FOR_LOAD_AND_LAUNCH; 74 action.action_type = LAUNCH_FOR_LOAD_AND_LAUNCH;
75 action.command_line = command_line; 75 action.command_line = command_line;
76 action.current_dir = current_dir; 76 action.current_dir = current_dir;
77 return true; 77 return true;
78 } 78 }
79 79
80 bool AppLoadService::Load(const base::FilePath& extension_path) {
81 ExtensionService* extension_service =
82 ExtensionSystem::Get(profile_)->extension_service();
83 std::string extension_id;
84 return extensions::UnpackedInstaller::Create(extension_service)->
85 LoadFromCommandLine(base::FilePath(extension_path), &extension_id);
86 }
87
80 // static 88 // static
81 AppLoadService* AppLoadService::Get(Profile* profile) { 89 AppLoadService* AppLoadService::Get(Profile* profile) {
82 return apps::AppLoadServiceFactory::GetForProfile(profile); 90 return apps::AppLoadServiceFactory::GetForProfile(profile);
83 } 91 }
84 92
85 void AppLoadService::Observe(int type, 93 void AppLoadService::Observe(int type,
86 const content::NotificationSource& source, 94 const content::NotificationSource& source,
87 const content::NotificationDetails& details) { 95 const content::NotificationDetails& details) {
88 DCHECK_EQ(type, extensions::NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING); 96 DCHECK_EQ(type, extensions::NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING);
89 extensions::ExtensionHost* host = 97 extensions::ExtensionHost* host =
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 Extension::DISABLE_RELOAD) != 0; 151 Extension::DISABLE_RELOAD) != 0;
144 } 152 }
145 return false; 153 return false;
146 } 154 }
147 155
148 bool AppLoadService::HasPostReloadAction(const std::string& extension_id) { 156 bool AppLoadService::HasPostReloadAction(const std::string& extension_id) {
149 return post_reload_actions_.find(extension_id) != post_reload_actions_.end(); 157 return post_reload_actions_.find(extension_id) != post_reload_actions_.end();
150 } 158 }
151 159
152 } // namespace apps 160 } // namespace apps
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698