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

Side by Side Diff: chrome/browser/extensions/web_intent_callbacks.h

Issue 10828172: Allow platform apps to respond to Web Intents (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Added WebIntentCallbacks profile keyed class to manage callbacks Created 8 years, 4 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 #ifndef CHROME_BROWSER_EXTENSIONS_WEB_INTENT_CALLBACKS_H_
6 #define CHROME_BROWSER_EXTENSIONS_WEB_INTENT_CALLBACKS_H_
7
8 #include <set>
9
10 #include "base/compiler_specific.h"
11 #include "base/memory/singleton.h"
12 #include "base/observer_list.h"
13 #include "chrome/browser/profiles/profile_keyed_service.h"
14 #include "chrome/browser/profiles/profile_keyed_service_factory.h"
15 #include "ui/gfx/native_widget_types.h"
16
17 class Profile;
18
19 namespace content {
20 class WebIntentsDispatcher;
21 }
22
23 // The WebIntentsCallback class tracks the pending callbacks for web intents
koz (OOO until 15th September) 2012/08/08 04:47:30 s/WebIntentsCallback/WebIntentCallbacks/
thorogood 2012/08/08 07:15:49 Thanks. I'm not sure about this as the actual clas
24 // that have been delivered to platform apps, for a particular profile.
25 class WebIntentCallbacks : public ProfileKeyedService {
26 public:
27 typedef std::map<std::string, content::WebIntentsDispatcher*> CallbackMap;
28
29 WebIntentCallbacks();
30 virtual ~WebIntentCallbacks();
31
32 // Returns the instance for the given profile. This is a convenience wrapper
33 // around WebIntentCallbacks::Factory::GetForProfile.
34 static WebIntentCallbacks* Get(Profile* profile);
35
36 std::string RegisterCallback(content::WebIntentsDispatcher* dispatcher);
koz (OOO until 15th September) 2012/08/08 04:47:30 Comments on this and RetrieveCallback().
thorogood 2012/08/08 07:15:49 Done.
37 content::WebIntentsDispatcher* RetrieveCallback(std::string key);
38
39 private:
40 class Factory : public ProfileKeyedServiceFactory {
41 public:
42 static WebIntentCallbacks* GetForProfile(Profile* profile);
43
44 static Factory* GetInstance();
45 private:
46 friend struct DefaultSingletonTraits<Factory>;
47
48 Factory();
49 virtual ~Factory();
50
51 // ProfileKeyedServiceFactory
52 virtual ProfileKeyedService* BuildServiceInstanceFor(
53 Profile* profile) const OVERRIDE;
54 };
55
56 int last_id_;
57
58 CallbackMap pending_;
59 };
60
61 #endif // CHROME_BROWSER_EXTENSIONS_WEB_INTENT_CALLBACKS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698