| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "chrome/browser/extensions/api/extension_action/script_badge_api.h" | |
| 6 | |
| 7 #include "base/lazy_instance.h" | |
| 8 #include "chrome/browser/extensions/extension_function_registry.h" | |
| 9 #include "chrome/browser/extensions/location_bar_controller.h" | |
| 10 #include "chrome/browser/extensions/tab_helper.h" | |
| 11 #include "chrome/common/extensions/api/extension_action/script_badge_handler.h" | |
| 12 #include "chrome/common/extensions/extension_manifest_constants.h" | |
| 13 #include "chrome/common/extensions/manifest_handler.h" | |
| 14 #include "content/public/browser/web_contents.h" | |
| 15 | |
| 16 namespace extensions { | |
| 17 | |
| 18 static base::LazyInstance<ProfileKeyedAPIFactory<ScriptBadgeAPI> > | |
| 19 g_factory = LAZY_INSTANCE_INITIALIZER; | |
| 20 | |
| 21 ScriptBadgeAPI::ScriptBadgeAPI(Profile* profile) { | |
| 22 ManifestHandler::Register(extension_manifest_keys::kScriptBadge, | |
| 23 new ScriptBadgeHandler); | |
| 24 ExtensionFunctionRegistry* registry = | |
| 25 ExtensionFunctionRegistry::GetInstance(); | |
| 26 registry->RegisterFunction<ScriptBadgeGetAttentionFunction>(); | |
| 27 registry->RegisterFunction<ScriptBadgeGetPopupFunction>(); | |
| 28 registry->RegisterFunction<ScriptBadgeSetPopupFunction>(); | |
| 29 } | |
| 30 | |
| 31 ScriptBadgeAPI::~ScriptBadgeAPI() { | |
| 32 } | |
| 33 | |
| 34 // static | |
| 35 ProfileKeyedAPIFactory<ScriptBadgeAPI>* ScriptBadgeAPI::GetFactoryInstance() { | |
| 36 return &g_factory.Get(); | |
| 37 } | |
| 38 | |
| 39 ScriptBadgeGetAttentionFunction::~ScriptBadgeGetAttentionFunction() { | |
| 40 } | |
| 41 | |
| 42 bool ScriptBadgeGetAttentionFunction::RunExtensionAction() { | |
| 43 tab_helper().location_bar_controller()->GetAttentionFor(extension_id()); | |
| 44 return true; | |
| 45 } | |
| 46 | |
| 47 } // namespace extensions | |
| OLD | NEW |