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

Side by Side Diff: chrome/browser/extensions/api/management/management_api.cc

Issue 11682005: Remove some Profile-keyed factory boilerplate: management omnibox preference push_messaging. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 11 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
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/api/management/management_api.h" 5 #include "chrome/browser/extensions/api/management/management_api.h"
6 6
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/bind.h" 12 #include "base/bind.h"
13 #include "base/json/json_writer.h" 13 #include "base/json/json_writer.h"
14 #include "base/lazy_instance.h"
14 #include "base/memory/linked_ptr.h" 15 #include "base/memory/linked_ptr.h"
15 #include "base/memory/scoped_ptr.h" 16 #include "base/memory/scoped_ptr.h"
16 #include "base/metrics/histogram.h" 17 #include "base/metrics/histogram.h"
17 #include "base/string_number_conversions.h" 18 #include "base/string_number_conversions.h"
18 #include "base/string_util.h" 19 #include "base/string_util.h"
19 #include "base/utf_string_conversions.h" 20 #include "base/utf_string_conversions.h"
20 #include "chrome/browser/extensions/api/management/management_api_constants.h" 21 #include "chrome/browser/extensions/api/management/management_api_constants.h"
21 #include "chrome/browser/extensions/event_names.h" 22 #include "chrome/browser/extensions/event_names.h"
22 #include "chrome/browser/extensions/event_router.h" 23 #include "chrome/browser/extensions/event_router.h"
23 #include "chrome/browser/extensions/extension_service.h" 24 #include "chrome/browser/extensions/extension_service.h"
(...skipping 18 matching lines...) Expand all
42 #include "extensions/common/url_pattern.h" 43 #include "extensions/common/url_pattern.h"
43 44
44 #if !defined(OS_ANDROID) 45 #if !defined(OS_ANDROID)
45 #include "chrome/browser/ui/webui/ntp/app_launcher_handler.h" 46 #include "chrome/browser/ui/webui/ntp/app_launcher_handler.h"
46 #endif 47 #endif
47 48
48 using base::IntToString; 49 using base::IntToString;
49 using content::BrowserThread; 50 using content::BrowserThread;
50 using content::UtilityProcessHost; 51 using content::UtilityProcessHost;
51 using content::UtilityProcessHostClient; 52 using content::UtilityProcessHostClient;
52 using extensions::api::management::ExtensionInfo;
53 using extensions::api::management::IconInfo;
54 using extensions::ErrorUtils;
55 using extensions::Extension;
56 using extensions::ExtensionSystem;
57 using extensions::PermissionMessages;
58 53
59 namespace events = extensions::event_names;
60 namespace keys = extension_management_api_constants; 54 namespace keys = extension_management_api_constants;
61 namespace management = extensions::api::management; 55
56 namespace extensions {
57
58 namespace events = event_names;
59 namespace management = api::management;
62 60
63 namespace { 61 namespace {
64 62
65 typedef std::vector<linked_ptr<management::ExtensionInfo> > ExtensionInfoList; 63 typedef std::vector<linked_ptr<management::ExtensionInfo> > ExtensionInfoList;
66 typedef std::vector<linked_ptr<management::IconInfo> > IconInfoList; 64 typedef std::vector<linked_ptr<management::IconInfo> > IconInfoList;
67 65
68 enum AutoConfirmForTest { 66 enum AutoConfirmForTest {
69 DO_NOT_SKIP = 0, 67 DO_NOT_SKIP = 0,
70 PROCEED, 68 PROCEED,
71 ABORT 69 ABORT
(...skipping 25 matching lines...) Expand all
97 info->version = extension.VersionString(); 95 info->version = extension.VersionString();
98 info->description = extension.description(); 96 info->description = extension.description();
99 info->options_url = extension.options_url().spec(); 97 info->options_url = extension.options_url().spec();
100 info->homepage_url.reset(new std::string( 98 info->homepage_url.reset(new std::string(
101 extension.GetHomepageURL().spec())); 99 extension.GetHomepageURL().spec()));
102 info->may_disable = system->management_policy()-> 100 info->may_disable = system->management_policy()->
103 UserMayModifySettings(&extension, NULL); 101 UserMayModifySettings(&extension, NULL);
104 info->is_app = extension.is_app(); 102 info->is_app = extension.is_app();
105 if (info->is_app) { 103 if (info->is_app) {
106 if (extension.is_legacy_packaged_app()) 104 if (extension.is_legacy_packaged_app())
107 info->type = ExtensionInfo::TYPE_LEGACY_PACKAGED_APP; 105 info->type = management::ExtensionInfo::TYPE_LEGACY_PACKAGED_APP;
108 else if (extension.is_hosted_app()) 106 else if (extension.is_hosted_app())
109 info->type = ExtensionInfo::TYPE_HOSTED_APP; 107 info->type = management::ExtensionInfo::TYPE_HOSTED_APP;
110 else 108 else
111 info->type = ExtensionInfo::TYPE_PACKAGED_APP; 109 info->type = management::ExtensionInfo::TYPE_PACKAGED_APP;
112 } else if (extension.is_theme()) { 110 } else if (extension.is_theme()) {
113 info->type = ExtensionInfo::TYPE_THEME; 111 info->type = management::ExtensionInfo::TYPE_THEME;
114 } else { 112 } else {
115 info->type = ExtensionInfo::TYPE_EXTENSION; 113 info->type = management::ExtensionInfo::TYPE_EXTENSION;
116 } 114 }
117 115
118 if (info->enabled) { 116 if (info->enabled) {
119 info->disabled_reason = management::ExtensionInfo::DISABLED_REASON_NONE; 117 info->disabled_reason = management::ExtensionInfo::DISABLED_REASON_NONE;
120 } else { 118 } else {
121 extensions::ExtensionPrefs* prefs = service->extension_prefs(); 119 ExtensionPrefs* prefs = service->extension_prefs();
122 if (prefs->DidExtensionEscalatePermissions(extension.id())) { 120 if (prefs->DidExtensionEscalatePermissions(extension.id())) {
123 info->disabled_reason = 121 info->disabled_reason =
124 management::ExtensionInfo::DISABLED_REASON_PERMISSIONS_INCREASE; 122 management::ExtensionInfo::DISABLED_REASON_PERMISSIONS_INCREASE;
125 } else { 123 } else {
126 info->disabled_reason = 124 info->disabled_reason =
127 management::ExtensionInfo::DISABLED_REASON_UNKNOWN; 125 management::ExtensionInfo::DISABLED_REASON_UNKNOWN;
128 } 126 }
129 } 127 }
130 128
131 if (!extension.update_url().is_empty()) { 129 if (!extension.update_url().is_empty()) {
(...skipping 24 matching lines...) Expand all
156 const std::set<std::string> perms = 154 const std::set<std::string> perms =
157 extension.GetActivePermissions()->GetAPIsAsStrings(); 155 extension.GetActivePermissions()->GetAPIsAsStrings();
158 if (!perms.empty()) { 156 if (!perms.empty()) {
159 std::set<std::string>::const_iterator perms_iter; 157 std::set<std::string>::const_iterator perms_iter;
160 for (perms_iter = perms.begin(); perms_iter != perms.end(); ++perms_iter) 158 for (perms_iter = perms.begin(); perms_iter != perms.end(); ++perms_iter)
161 info->permissions.push_back(*perms_iter); 159 info->permissions.push_back(*perms_iter);
162 } 160 }
163 161
164 if (!extension.is_hosted_app()) { 162 if (!extension.is_hosted_app()) {
165 // Skip host permissions for hosted apps. 163 // Skip host permissions for hosted apps.
166 const extensions::URLPatternSet host_perms = 164 const URLPatternSet host_perms =
167 extension.GetActivePermissions()->explicit_hosts(); 165 extension.GetActivePermissions()->explicit_hosts();
168 if (!host_perms.is_empty()) { 166 if (!host_perms.is_empty()) {
169 for (extensions::URLPatternSet::const_iterator iter = host_perms.begin(); 167 for (URLPatternSet::const_iterator iter = host_perms.begin();
170 iter != host_perms.end(); ++iter) { 168 iter != host_perms.end(); ++iter) {
171 info->host_permissions.push_back(iter->GetAsString()); 169 info->host_permissions.push_back(iter->GetAsString());
172 } 170 }
173 } 171 }
174 } 172 }
175 173
176 switch (extension.location()) { 174 switch (extension.location()) {
177 case Extension::INTERNAL: 175 case Extension::INTERNAL:
178 info->install_type = management::ExtensionInfo::INSTALL_TYPE_NORMAL; 176 info->install_type = management::ExtensionInfo::INSTALL_TYPE_NORMAL;
179 break; 177 break;
(...skipping 26 matching lines...) Expand all
206 if (extension.location() == Extension::COMPONENT) 204 if (extension.location() == Extension::COMPONENT)
207 continue; // Skip built-in extensions. 205 continue; // Skip built-in extensions.
208 206
209 extension_list->push_back(make_linked_ptr<management::ExtensionInfo>( 207 extension_list->push_back(make_linked_ptr<management::ExtensionInfo>(
210 CreateExtensionInfo(extension, system).release())); 208 CreateExtensionInfo(extension, system).release()));
211 } 209 }
212 } 210 }
213 211
214 } // namespace 212 } // namespace
215 213
216 ExtensionService* ExtensionManagementFunction::service() { 214 ExtensionService* ManagementFunction::service() {
217 return profile()->GetExtensionService(); 215 return profile()->GetExtensionService();
218 } 216 }
219 217
220 ExtensionService* AsyncExtensionManagementFunction::service() { 218 ExtensionService* AsyncManagementFunction::service() {
221 return profile()->GetExtensionService(); 219 return profile()->GetExtensionService();
222 } 220 }
223 221
224 bool GetAllExtensionsFunction::RunImpl() { 222 bool GetAllExtensionsFunction::RunImpl() {
225 ExtensionInfoList extensions; 223 ExtensionInfoList extensions;
226 ExtensionSystem* system = ExtensionSystem::Get(profile()); 224 ExtensionSystem* system = ExtensionSystem::Get(profile());
227 225
228 AddExtensionInfo(*service()->extensions(), system, &extensions); 226 AddExtensionInfo(*service()->extensions(), system, &extensions);
229 AddExtensionInfo(*service()->disabled_extensions(), system, &extensions); 227 AddExtensionInfo(*service()->disabled_extensions(), system, &extensions);
230 AddExtensionInfo(*service()->terminated_extensions(), system, &extensions); 228 AddExtensionInfo(*service()->terminated_extensions(), system, &extensions);
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 error_ = ErrorUtils::FormatErrorMessage(keys::kNotAnAppError, 418 error_ = ErrorUtils::FormatErrorMessage(keys::kNotAnAppError,
421 params->id); 419 params->id);
422 return false; 420 return false;
423 } 421 }
424 422
425 // Look at prefs to find the right launch container. 423 // Look at prefs to find the right launch container.
426 // |default_pref_value| is set to LAUNCH_REGULAR so that if 424 // |default_pref_value| is set to LAUNCH_REGULAR so that if
427 // the user has not set a preference, we open the app in a tab. 425 // the user has not set a preference, we open the app in a tab.
428 extension_misc::LaunchContainer launch_container = 426 extension_misc::LaunchContainer launch_container =
429 service()->extension_prefs()->GetLaunchContainer( 427 service()->extension_prefs()->GetLaunchContainer(
430 extension, extensions::ExtensionPrefs::LAUNCH_DEFAULT); 428 extension, ExtensionPrefs::LAUNCH_DEFAULT);
431 application_launch::OpenApplication(application_launch::LaunchParams( 429 application_launch::OpenApplication(application_launch::LaunchParams(
432 profile(), extension, launch_container, NEW_FOREGROUND_TAB)); 430 profile(), extension, launch_container, NEW_FOREGROUND_TAB));
433 #if !defined(OS_ANDROID) 431 #if !defined(OS_ANDROID)
434 AppLauncherHandler::RecordAppLaunchType( 432 AppLauncherHandler::RecordAppLaunchType(
435 extension_misc::APP_LAUNCH_EXTENSION_API); 433 extension_misc::APP_LAUNCH_EXTENSION_API);
436 #endif 434 #endif
437 435
438 return true; 436 return true;
439 } 437 }
440 438
(...skipping 10 matching lines...) Expand all
451 449
452 extension_id_ = params->id; 450 extension_id_ = params->id;
453 451
454 const Extension* extension = service()->GetInstalledExtension(extension_id_); 452 const Extension* extension = service()->GetInstalledExtension(extension_id_);
455 if (!extension) { 453 if (!extension) {
456 error_ = ErrorUtils::FormatErrorMessage( 454 error_ = ErrorUtils::FormatErrorMessage(
457 keys::kNoExtensionError, extension_id_); 455 keys::kNoExtensionError, extension_id_);
458 return false; 456 return false;
459 } 457 }
460 458
461 const extensions::ManagementPolicy* policy = extensions::ExtensionSystem::Get( 459 const ManagementPolicy* policy = ExtensionSystem::Get(profile())->
462 profile())->management_policy(); 460 management_policy();
463 if (!policy->UserMayModifySettings(extension, NULL)) { 461 if (!policy->UserMayModifySettings(extension, NULL)) {
464 error_ = ErrorUtils::FormatErrorMessage( 462 error_ = ErrorUtils::FormatErrorMessage(
465 keys::kUserCantModifyError, extension_id_); 463 keys::kUserCantModifyError, extension_id_);
466 return false; 464 return false;
467 } 465 }
468 466
469 bool currently_enabled = service()->IsExtensionEnabled(extension_id_); 467 bool currently_enabled = service()->IsExtensionEnabled(extension_id_);
470 468
471 if (!currently_enabled && params->enabled) { 469 if (!currently_enabled && params->enabled) {
472 extensions::ExtensionPrefs* prefs = service()->extension_prefs(); 470 ExtensionPrefs* prefs = service()->extension_prefs();
473 if (prefs->DidExtensionEscalatePermissions(extension_id_)) { 471 if (prefs->DidExtensionEscalatePermissions(extension_id_)) {
474 if (!user_gesture()) { 472 if (!user_gesture()) {
475 error_ = keys::kGestureNeededForEscalationError; 473 error_ = keys::kGestureNeededForEscalationError;
476 return false; 474 return false;
477 } 475 }
478 AddRef(); // Matched in InstallUIProceed/InstallUIAbort 476 AddRef(); // Matched in InstallUIProceed/InstallUIAbort
479 install_prompt_.reset( 477 install_prompt_.reset(
480 new ExtensionInstallPrompt(GetAssociatedWebContents())); 478 new ExtensionInstallPrompt(GetAssociatedWebContents()));
481 install_prompt_->ConfirmReEnable(this, extension); 479 install_prompt_->ConfirmReEnable(this, extension);
482 return true; 480 return true;
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
523 if (params->options.get() && params->options->show_confirm_dialog.get()) 521 if (params->options.get() && params->options->show_confirm_dialog.get())
524 show_confirm_dialog = *params->options->show_confirm_dialog; 522 show_confirm_dialog = *params->options->show_confirm_dialog;
525 523
526 const Extension* extension = service()->GetExtensionById(extension_id_, true); 524 const Extension* extension = service()->GetExtensionById(extension_id_, true);
527 if (!extension) { 525 if (!extension) {
528 error_ = ErrorUtils::FormatErrorMessage( 526 error_ = ErrorUtils::FormatErrorMessage(
529 keys::kNoExtensionError, extension_id_); 527 keys::kNoExtensionError, extension_id_);
530 return false; 528 return false;
531 } 529 }
532 530
533 if (!extensions::ExtensionSystem::Get( 531 if (!ExtensionSystem::Get(profile())->management_policy()->
534 profile())->management_policy()->UserMayModifySettings(extension, NULL)) { 532 UserMayModifySettings(extension, NULL)) {
535 error_ = ErrorUtils::FormatErrorMessage( 533 error_ = ErrorUtils::FormatErrorMessage(
536 keys::kUserCantModifyError, extension_id_); 534 keys::kUserCantModifyError, extension_id_);
537 return false; 535 return false;
538 } 536 }
539 537
540 if (auto_confirm_for_test == DO_NOT_SKIP) { 538 if (auto_confirm_for_test == DO_NOT_SKIP) {
541 if (show_confirm_dialog) { 539 if (show_confirm_dialog) {
542 AddRef(); // Balanced in ExtensionUninstallAccepted/Canceled 540 AddRef(); // Balanced in ExtensionUninstallAccepted/Canceled
543 extension_uninstall_dialog_.reset(ExtensionUninstallDialog::Create( 541 extension_uninstall_dialog_.reset(ExtensionUninstallDialog::Create(
544 GetCurrentBrowser(), this)); 542 GetCurrentBrowser(), this));
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
578 void UninstallFunction::ExtensionUninstallAccepted() { 576 void UninstallFunction::ExtensionUninstallAccepted() {
579 Finish(true); 577 Finish(true);
580 Release(); 578 Release();
581 } 579 }
582 580
583 void UninstallFunction::ExtensionUninstallCanceled() { 581 void UninstallFunction::ExtensionUninstallCanceled() {
584 Finish(false); 582 Finish(false);
585 Release(); 583 Release();
586 } 584 }
587 585
588 ExtensionManagementEventRouter::ExtensionManagementEventRouter(Profile* profile) 586 ManagementEventRouter::ManagementEventRouter(Profile* profile)
589 : profile_(profile) { 587 : profile_(profile) {
590 int types[] = { 588 int types[] = {
591 chrome::NOTIFICATION_EXTENSION_INSTALLED, 589 chrome::NOTIFICATION_EXTENSION_INSTALLED,
592 chrome::NOTIFICATION_EXTENSION_UNINSTALLED, 590 chrome::NOTIFICATION_EXTENSION_UNINSTALLED,
593 chrome::NOTIFICATION_EXTENSION_LOADED, 591 chrome::NOTIFICATION_EXTENSION_LOADED,
594 chrome::NOTIFICATION_EXTENSION_UNLOADED 592 chrome::NOTIFICATION_EXTENSION_UNLOADED
595 }; 593 };
596 594
597 CHECK(registrar_.IsEmpty()); 595 CHECK(registrar_.IsEmpty());
598 for (size_t i = 0; i < arraysize(types); i++) { 596 for (size_t i = 0; i < arraysize(types); i++) {
599 registrar_.Add(this, 597 registrar_.Add(this,
600 types[i], 598 types[i],
601 content::Source<Profile>(profile_)); 599 content::Source<Profile>(profile_));
602 } 600 }
603 } 601 }
604 602
605 ExtensionManagementEventRouter::~ExtensionManagementEventRouter() {} 603 ManagementEventRouter::~ManagementEventRouter() {}
606 604
607 void ExtensionManagementEventRouter::Observe( 605 void ManagementEventRouter::Observe(
608 int type, 606 int type,
609 const content::NotificationSource& source, 607 const content::NotificationSource& source,
610 const content::NotificationDetails& details) { 608 const content::NotificationDetails& details) {
611 const char* event_name = NULL; 609 const char* event_name = NULL;
612 Profile* profile = content::Source<Profile>(source).ptr(); 610 Profile* profile = content::Source<Profile>(source).ptr();
613 CHECK(profile); 611 CHECK(profile);
614 CHECK(profile_->IsSameProfile(profile)); 612 CHECK(profile_->IsSameProfile(profile));
615 613
616 switch (type) { 614 switch (type) {
617 case chrome::NOTIFICATION_EXTENSION_INSTALLED: 615 case chrome::NOTIFICATION_EXTENSION_INSTALLED:
(...skipping 13 matching lines...) Expand all
631 return; 629 return;
632 } 630 }
633 631
634 scoped_ptr<ListValue> args(new ListValue()); 632 scoped_ptr<ListValue> args(new ListValue());
635 if (event_name == events::kOnExtensionUninstalled) { 633 if (event_name == events::kOnExtensionUninstalled) {
636 args->Append(Value::CreateStringValue( 634 args->Append(Value::CreateStringValue(
637 content::Details<const Extension>(details).ptr()->id())); 635 content::Details<const Extension>(details).ptr()->id()));
638 } else { 636 } else {
639 const Extension* extension = NULL; 637 const Extension* extension = NULL;
640 if (event_name == events::kOnExtensionDisabled) { 638 if (event_name == events::kOnExtensionDisabled) {
641 extension = content::Details<extensions::UnloadedExtensionInfo>( 639 extension = content::Details<UnloadedExtensionInfo>(details)->extension;
642 details)->extension;
643 } else { 640 } else {
644 extension = content::Details<const Extension>(details).ptr(); 641 extension = content::Details<const Extension>(details).ptr();
645 } 642 }
646 CHECK(extension); 643 CHECK(extension);
647 scoped_ptr<management::ExtensionInfo> info = CreateExtensionInfo( 644 scoped_ptr<management::ExtensionInfo> info = CreateExtensionInfo(
648 *extension, ExtensionSystem::Get(profile)); 645 *extension, ExtensionSystem::Get(profile));
649 args->Append(info->ToValue().release()); 646 args->Append(info->ToValue().release());
650 } 647 }
651 648
652 scoped_ptr<extensions::Event> event(new extensions::Event( 649 scoped_ptr<Event> event(new Event(event_name, args.Pass()));
653 event_name, args.Pass())); 650 ExtensionSystem::Get(profile)->event_router()->BroadcastEvent(event.Pass());
654 extensions::ExtensionSystem::Get(profile)->event_router()->
655 BroadcastEvent(event.Pass());
656 } 651 }
657 652
658 ExtensionManagementAPI::ExtensionManagementAPI(Profile* profile) 653 ManagementAPI::ManagementAPI(Profile* profile)
659 : profile_(profile) { 654 : profile_(profile) {
660 ExtensionSystem::Get(profile_)->event_router()->RegisterObserver( 655 ExtensionSystem::Get(profile_)->event_router()->RegisterObserver(
661 this, events::kOnExtensionInstalled); 656 this, events::kOnExtensionInstalled);
662 ExtensionSystem::Get(profile_)->event_router()->RegisterObserver( 657 ExtensionSystem::Get(profile_)->event_router()->RegisterObserver(
663 this, events::kOnExtensionUninstalled); 658 this, events::kOnExtensionUninstalled);
664 ExtensionSystem::Get(profile_)->event_router()->RegisterObserver( 659 ExtensionSystem::Get(profile_)->event_router()->RegisterObserver(
665 this, events::kOnExtensionEnabled); 660 this, events::kOnExtensionEnabled);
666 ExtensionSystem::Get(profile_)->event_router()->RegisterObserver( 661 ExtensionSystem::Get(profile_)->event_router()->RegisterObserver(
667 this, events::kOnExtensionDisabled); 662 this, events::kOnExtensionDisabled);
668 } 663 }
669 664
670 ExtensionManagementAPI::~ExtensionManagementAPI() { 665 ManagementAPI::~ManagementAPI() {
671 } 666 }
672 667
673 void ExtensionManagementAPI::Shutdown() { 668 void ManagementAPI::Shutdown() {
674 ExtensionSystem::Get(profile_)->event_router()->UnregisterObserver(this); 669 ExtensionSystem::Get(profile_)->event_router()->UnregisterObserver(this);
675 } 670 }
676 671
677 void ExtensionManagementAPI::OnListenerAdded( 672 static base::LazyInstance<ProfileKeyedAPIFactory<ManagementAPI> >
678 const extensions::EventListenerInfo& details) { 673 g_factory = LAZY_INSTANCE_INITIALIZER;
679 management_event_router_.reset(new ExtensionManagementEventRouter(profile_)); 674
675 // static
676 ProfileKeyedAPIFactory<ManagementAPI>* ManagementAPI::GetFactoryInstance() {
677 return &g_factory.Get();
678 }
679
680 void ManagementAPI::OnListenerAdded(const EventListenerInfo& details) {
681 management_event_router_.reset(new ManagementEventRouter(profile_));
680 ExtensionSystem::Get(profile_)->event_router()->UnregisterObserver(this); 682 ExtensionSystem::Get(profile_)->event_router()->UnregisterObserver(this);
681 } 683 }
684
685 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698