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

Side by Side Diff: extensions/browser/api/runtime/runtime_api.cc

Issue 345693002: Extensions: Split extensions utility IPC messages into its own file. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: disable another test Created 6 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « chrome/utility/media_galleries/ipc_data_source.cc ('k') | extensions/extensions.gyp » ('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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "extensions/browser/api/runtime/runtime_api.h" 5 #include "extensions/browser/api/runtime/runtime_api.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 system->event_router()->DispatchEventToExtension(extension_id, event.Pass()); 110 system->event_router()->DispatchEventToExtension(extension_id, event.Pass());
111 } 111 }
112 112
113 void SetUninstallURL(ExtensionPrefs* prefs, 113 void SetUninstallURL(ExtensionPrefs* prefs,
114 const std::string& extension_id, 114 const std::string& extension_id,
115 const std::string& url_string) { 115 const std::string& url_string) {
116 prefs->UpdateExtensionPref( 116 prefs->UpdateExtensionPref(
117 extension_id, kUninstallUrl, new base::StringValue(url_string)); 117 extension_id, kUninstallUrl, new base::StringValue(url_string));
118 } 118 }
119 119
120 #if defined(ENABLE_EXTENSIONS)
121 std::string GetUninstallURL(ExtensionPrefs* prefs, 120 std::string GetUninstallURL(ExtensionPrefs* prefs,
122 const std::string& extension_id) { 121 const std::string& extension_id) {
123 std::string url_string; 122 std::string url_string;
124 prefs->ReadPrefAsString(extension_id, kUninstallUrl, &url_string); 123 prefs->ReadPrefAsString(extension_id, kUninstallUrl, &url_string);
125 return url_string; 124 return url_string;
126 } 125 }
127 #endif // defined(ENABLE_EXTENSIONS)
128 126
129 } // namespace 127 } // namespace
130 128
131 /////////////////////////////////////////////////////////////////////////////// 129 ///////////////////////////////////////////////////////////////////////////////
132 130
133 static base::LazyInstance<BrowserContextKeyedAPIFactory<RuntimeAPI> > 131 static base::LazyInstance<BrowserContextKeyedAPIFactory<RuntimeAPI> >
134 g_factory = LAZY_INSTANCE_INITIALIZER; 132 g_factory = LAZY_INSTANCE_INITIALIZER;
135 133
136 // static 134 // static
137 BrowserContextKeyedAPIFactory<RuntimeAPI>* RuntimeAPI::GetFactoryInstance() { 135 BrowserContextKeyedAPIFactory<RuntimeAPI>* RuntimeAPI::GetFactoryInstance() {
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 core_api::runtime::OnRestartRequired::Create(reason))); 406 core_api::runtime::OnRestartRequired::Create(reason)));
409 407
410 DCHECK(system->event_router()); 408 DCHECK(system->event_router());
411 system->event_router()->DispatchEventToExtension(app_id, event.Pass()); 409 system->event_router()->DispatchEventToExtension(app_id, event.Pass());
412 } 410 }
413 411
414 // static 412 // static
415 void RuntimeEventRouter::OnExtensionUninstalled( 413 void RuntimeEventRouter::OnExtensionUninstalled(
416 content::BrowserContext* context, 414 content::BrowserContext* context,
417 const std::string& extension_id) { 415 const std::string& extension_id) {
418 #if defined(ENABLE_EXTENSIONS)
419 GURL uninstall_url( 416 GURL uninstall_url(
420 GetUninstallURL(ExtensionPrefs::Get(context), extension_id)); 417 GetUninstallURL(ExtensionPrefs::Get(context), extension_id));
421 418
422 if (uninstall_url.is_empty()) 419 if (uninstall_url.is_empty())
423 return; 420 return;
424 421
425 RuntimeAPI::GetFactoryInstance()->Get(context)->OpenURL(uninstall_url); 422 RuntimeAPI::GetFactoryInstance()->Get(context)->OpenURL(uninstall_url);
426 #endif // defined(ENABLE_EXTENSIONS)
427 } 423 }
428 424
429 ExtensionFunction::ResponseAction RuntimeGetBackgroundPageFunction::Run() { 425 ExtensionFunction::ResponseAction RuntimeGetBackgroundPageFunction::Run() {
430 ExtensionSystem* system = ExtensionSystem::Get(browser_context()); 426 ExtensionSystem* system = ExtensionSystem::Get(browser_context());
431 ExtensionHost* host = 427 ExtensionHost* host =
432 system->process_manager()->GetBackgroundHostForExtension(extension_id()); 428 system->process_manager()->GetBackgroundHostForExtension(extension_id());
433 if (system->lazy_background_task_queue()->ShouldEnqueueTask(browser_context(), 429 if (system->lazy_background_task_queue()->ShouldEnqueueTask(browser_context(),
434 GetExtension())) { 430 GetExtension())) {
435 system->lazy_background_task_queue()->AddPendingTask( 431 system->lazy_background_task_queue()->AddPendingTask(
436 browser_context(), 432 browser_context(),
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
534 content::ChildProcessSecurityPolicy* policy = 530 content::ChildProcessSecurityPolicy* policy =
535 content::ChildProcessSecurityPolicy::GetInstance(); 531 content::ChildProcessSecurityPolicy::GetInstance();
536 policy->GrantReadFileSystem(renderer_id, filesystem_id); 532 policy->GrantReadFileSystem(renderer_id, filesystem_id);
537 base::DictionaryValue* dict = new base::DictionaryValue(); 533 base::DictionaryValue* dict = new base::DictionaryValue();
538 dict->SetString("fileSystemId", filesystem_id); 534 dict->SetString("fileSystemId", filesystem_id);
539 dict->SetString("baseName", relative_path); 535 dict->SetString("baseName", relative_path);
540 return RespondNow(OneArgument(dict)); 536 return RespondNow(OneArgument(dict));
541 } 537 }
542 538
543 } // namespace extensions 539 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/utility/media_galleries/ipc_data_source.cc ('k') | extensions/extensions.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698