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

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

Issue 10824030: Move ExtensionHost into extensions namespace (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Latest master for cq Created 8 years, 4 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 | « chrome/browser/extensions/message_service.h ('k') | chrome/browser/file_select_helper.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 (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_path.h" 8 #include "base/file_path.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 ExtensionSystem::Get(profile_)->lazy_background_task_queue(); 165 ExtensionSystem::Get(profile_)->lazy_background_task_queue();
166 if (queue->ShouldEnqueueTask(profile_, extension_)) { 166 if (queue->ShouldEnqueueTask(profile_, extension_)) {
167 queue->AddPendingTask(profile_, extension_->id(), base::Bind( 167 queue->AddPendingTask(profile_, extension_->id(), base::Bind(
168 &PlatformAppCommandLineLauncher::GrantAccessToFileAndLaunch, 168 &PlatformAppCommandLineLauncher::GrantAccessToFileAndLaunch,
169 this, file_path, mime_type)); 169 this, file_path, mime_type));
170 return; 170 return;
171 } 171 }
172 172
173 ExtensionProcessManager* process_manager = 173 ExtensionProcessManager* process_manager =
174 ExtensionSystem::Get(profile_)->process_manager(); 174 ExtensionSystem::Get(profile_)->process_manager();
175 ExtensionHost* host = 175 extensions::ExtensionHost* host =
176 process_manager->GetBackgroundHostForExtension(extension_->id()); 176 process_manager->GetBackgroundHostForExtension(extension_->id());
177 DCHECK(host); 177 DCHECK(host);
178 GrantAccessToFileAndLaunch(file_path, mime_type, host); 178 GrantAccessToFileAndLaunch(file_path, mime_type, host);
179 } 179 }
180 180
181 void GrantAccessToFileAndLaunch(const FilePath& file_path, 181 void GrantAccessToFileAndLaunch(const FilePath& file_path,
182 const std::string& mime_type, 182 const std::string& mime_type,
183 ExtensionHost* host) { 183 extensions::ExtensionHost* host) {
184 // If there was an error loading the app page, |host| will be NULL. 184 // If there was an error loading the app page, |host| will be NULL.
185 if (!host) { 185 if (!host) {
186 LOG(ERROR) << "Could not load app page for " << extension_->id(); 186 LOG(ERROR) << "Could not load app page for " << extension_->id();
187 return; 187 return;
188 } 188 }
189 189
190 content::ChildProcessSecurityPolicy* policy = 190 content::ChildProcessSecurityPolicy* policy =
191 content::ChildProcessSecurityPolicy::GetInstance(); 191 content::ChildProcessSecurityPolicy::GetInstance();
192 int renderer_id = host->render_process_host()->GetID(); 192 int renderer_id = host->render_process_host()->GetID();
193 193
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 ExtensionSystem::Get(profile_)->lazy_background_task_queue(); 253 ExtensionSystem::Get(profile_)->lazy_background_task_queue();
254 if (queue->ShouldEnqueueTask(profile_, extension_)) { 254 if (queue->ShouldEnqueueTask(profile_, extension_)) {
255 queue->AddPendingTask(profile_, extension_->id(), base::Bind( 255 queue->AddPendingTask(profile_, extension_->id(), base::Bind(
256 &PlatformAppBlobIntentLauncher::GrantAccessToFileAndLaunch, 256 &PlatformAppBlobIntentLauncher::GrantAccessToFileAndLaunch,
257 this)); 257 this));
258 return; 258 return;
259 } 259 }
260 260
261 ExtensionProcessManager* process_manager = 261 ExtensionProcessManager* process_manager =
262 ExtensionSystem::Get(profile_)->process_manager(); 262 ExtensionSystem::Get(profile_)->process_manager();
263 ExtensionHost* host = 263 extensions::ExtensionHost* host =
264 process_manager->GetBackgroundHostForExtension(extension_->id()); 264 process_manager->GetBackgroundHostForExtension(extension_->id());
265 DCHECK(host); 265 DCHECK(host);
266 GrantAccessToFileAndLaunch(host); 266 GrantAccessToFileAndLaunch(host);
267 } 267 }
268 268
269 private: 269 private:
270 friend class base::RefCountedThreadSafe<PlatformAppBlobIntentLauncher>; 270 friend class base::RefCountedThreadSafe<PlatformAppBlobIntentLauncher>;
271 271
272 virtual ~PlatformAppBlobIntentLauncher() {} 272 virtual ~PlatformAppBlobIntentLauncher() {}
273 273
274 void GrantAccessToFileAndLaunch(ExtensionHost* host) { 274 void GrantAccessToFileAndLaunch(extensions::ExtensionHost* host) {
275 // If there was an error loading the app page, |host| will be NULL. 275 // If there was an error loading the app page, |host| will be NULL.
276 if (!host) { 276 if (!host) {
277 LOG(ERROR) << "Could not load app page for " << extension_->id(); 277 LOG(ERROR) << "Could not load app page for " << extension_->id();
278 return; 278 return;
279 } 279 }
280 280
281 content::ChildProcessSecurityPolicy* policy = 281 content::ChildProcessSecurityPolicy* policy =
282 content::ChildProcessSecurityPolicy::GetInstance(); 282 content::ChildProcessSecurityPolicy::GetInstance();
283 int renderer_id = host->render_process_host()->GetID(); 283 int renderer_id = host->render_process_host()->GetID();
284 284
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 new PlatformAppBlobIntentLauncher(profile, extension, web_intent_data); 329 new PlatformAppBlobIntentLauncher(profile, extension, web_intent_data);
330 launcher->Launch(); 330 launcher->Launch();
331 return; 331 return;
332 } 332 }
333 333
334 extensions::AppEventRouter::DispatchOnLaunchedEventWithWebIntent( 334 extensions::AppEventRouter::DispatchOnLaunchedEventWithWebIntent(
335 profile, extension, web_intent_data); 335 profile, extension, web_intent_data);
336 } 336 }
337 337
338 } // namespace extensions 338 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/message_service.h ('k') | chrome/browser/file_select_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698