Chromium Code Reviews| 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_ |