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

Side by Side Diff: chrome/browser/extensions/api/page_launcher/page_launcher_api.cc

Issue 12095023: Allow platform apps to add themselves to the Action Box. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 7 years, 10 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) 2013 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/page_launcher/page_launcher_api.h"
6
7 #include "base/lazy_instance.h"
8 #include "chrome/browser/extensions/event_router.h"
9 #include "chrome/browser/extensions/extension_system.h"
10 #include "chrome/common/extensions/api/page_launcher.h"
11 #include "chrome/common/extensions/api/page_launcher/page_launcher_handler.h"
12 #include "chrome/common/extensions/extension_manifest_constants.h"
13 #include "chrome/common/extensions/manifest_handler.h"
14
15 namespace extensions {
16
17 static base::LazyInstance<ProfileKeyedAPIFactory<PageLauncherAPI> >
18 g_factory = LAZY_INSTANCE_INITIALIZER;
19
20 PageLauncherAPI::PageLauncherAPI(Profile* profile) {
21 ManifestHandler::Register(extension_manifest_keys::kPageLauncher,
22 new PageLauncherHandler);
23 }
24
25 PageLauncherAPI::~PageLauncherAPI() {
26 }
27
28 // static
29 void PageLauncherAPI::DispatchOnClickedEvent(
30 Profile* profile,
31 const std::string& extension_id,
32 const std::string& url,
not at google - send to devlin 2013/02/01 16:39:47 GURL?
Rune Fevang 2013/02/01 22:12:54 Done.
33 const std::string& mimetype,
34 scoped_ptr<std::string> page_title,
35 scoped_ptr<std::string> selected_text) {
36 api::page_launcher::PageData data;
37 data.url = url;
38 data.mimetype = mimetype;
39 data.page_title.swap(page_title);
40 data.selected_text.swap(selected_text);
41
42 scoped_ptr<Event> event(
43 new Event("pageLauncher.onClicked",
44 api::page_launcher::OnClicked::Create(data)));
45 EventRouter* event_router = ExtensionSystem::Get(profile)->event_router();
46 event_router->DispatchEventToExtension(extension_id, event.Pass());
47 }
48
49
50 // static
51 ProfileKeyedAPIFactory<PageLauncherAPI>* PageLauncherAPI::GetFactoryInstance() {
52 return &g_factory.Get();
53 }
54
55 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698