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

Side by Side Diff: chrome/browser/extensions/api/extension_action/script_badge_api.cc

Issue 11588004: Move ScriptBadge, ActionInfo out of Extension; preparation for BrowserAction (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Latest master for CQ 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
OLDNEW
(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
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/extension_action/script_badge_api.h ('k') | chrome/browser/extensions/browser_event_router.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698