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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/web_intent_callbacks.h
diff --git a/chrome/browser/extensions/web_intent_callbacks.h b/chrome/browser/extensions/web_intent_callbacks.h
new file mode 100644
index 0000000000000000000000000000000000000000..d9eb9aacd67fd65144b712af5ee162fa3e0e1045
--- /dev/null
+++ b/chrome/browser/extensions/web_intent_callbacks.h
@@ -0,0 +1,61 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_EXTENSIONS_WEB_INTENT_CALLBACKS_H_
+#define CHROME_BROWSER_EXTENSIONS_WEB_INTENT_CALLBACKS_H_
+
+#include <set>
+
+#include "base/compiler_specific.h"
+#include "base/memory/singleton.h"
+#include "base/observer_list.h"
+#include "chrome/browser/profiles/profile_keyed_service.h"
+#include "chrome/browser/profiles/profile_keyed_service_factory.h"
+#include "ui/gfx/native_widget_types.h"
+
+class Profile;
+
+namespace content {
+class WebIntentsDispatcher;
+}
+
+// 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
+// that have been delivered to platform apps, for a particular profile.
+class WebIntentCallbacks : public ProfileKeyedService {
+ public:
+ typedef std::map<std::string, content::WebIntentsDispatcher*> CallbackMap;
+
+ WebIntentCallbacks();
+ virtual ~WebIntentCallbacks();
+
+ // Returns the instance for the given profile. This is a convenience wrapper
+ // around WebIntentCallbacks::Factory::GetForProfile.
+ static WebIntentCallbacks* Get(Profile* profile);
+
+ 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.
+ content::WebIntentsDispatcher* RetrieveCallback(std::string key);
+
+ private:
+ class Factory : public ProfileKeyedServiceFactory {
+ public:
+ static WebIntentCallbacks* GetForProfile(Profile* profile);
+
+ static Factory* GetInstance();
+ private:
+ friend struct DefaultSingletonTraits<Factory>;
+
+ Factory();
+ virtual ~Factory();
+
+ // ProfileKeyedServiceFactory
+ virtual ProfileKeyedService* BuildServiceInstanceFor(
+ Profile* profile) const OVERRIDE;
+ };
+
+ int last_id_;
+
+ CallbackMap pending_;
+};
+
+#endif // CHROME_BROWSER_EXTENSIONS_WEB_INTENT_CALLBACKS_H_

Powered by Google App Engine
This is Rietveld 408576698