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

Unified Diff: chrome/browser/extensions/api/push_messaging/push_messaging_api.h

Issue 10836182: Obfuscated Gaia ID fetcher (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: rebase to master 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/api/push_messaging/push_messaging_api.h
diff --git a/chrome/browser/extensions/api/push_messaging/push_messaging_api.h b/chrome/browser/extensions/api/push_messaging/push_messaging_api.h
index 5d8e95cc92354a4aad3fbf48def392ed1988d9ac..f78fc6fc6f05089605f6b867b7ee493fb946f2db 100644
--- a/chrome/browser/extensions/api/push_messaging/push_messaging_api.h
+++ b/chrome/browser/extensions/api/push_messaging/push_messaging_api.h
@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+// This file includes the JavaScript interface for Push Messaging
dcheng 2012/08/16 19:12:43 Unnecessary comment.
Pete Williamson 2012/08/19 22:05:14 Done.
+
#ifndef CHROME_BROWSER_EXTENSIONS_API_PUSH_MESSAGING_PUSH_MESSAGING_API_H__
#define CHROME_BROWSER_EXTENSIONS_API_PUSH_MESSAGING_PUSH_MESSAGING_API_H__
@@ -10,11 +12,15 @@
#include "base/compiler_specific.h"
#include "base/gtest_prod_util.h"
#include "chrome/browser/extensions/api/push_messaging/invalidation_handler_observer.h"
+#include "chrome/browser/extensions/api/push_messaging/obfuscated_gaia_id_fetcher.h"
+#include "chrome/browser/extensions/extension_function.h"
class Profile;
namespace extensions {
+class ObfuscatedGaiaIdFetcher;
+
// Observes a single InvalidationHandler and generates onMessage events.
class PushMessagingEventRouter : public InvalidationHandlerObserver {
public:
@@ -36,6 +42,33 @@ class PushMessagingEventRouter : public InvalidationHandlerObserver {
DISALLOW_COPY_AND_ASSIGN(PushMessagingEventRouter);
};
+// Implements the getChannelId function, callabel from JavaScript
+// this relies on the ObfuscatedGaiaIdFetcher to get the GAIA ID
+// that we use to build the channel ID.
dcheng 2012/08/16 19:12:43 I would probably leave out this comment as it mere
Pete Williamson 2012/08/19 22:05:14 Sure, I'll do that, but I have a question on Philo
dcheng 2012/08/19 22:38:35 It's OK to comment on the 'what' if it's something
+class PushMessagingGetChannelIdFunction : public AsyncExtensionFunction {
Munjal (Google) 2012/08/15 23:04:19 This class should implement the delegate interface
Pete Williamson 2012/08/19 22:05:14 My first implementation did that, but after a disc
+ public:
Munjal (Google) 2012/08/15 23:04:19 Indentation is off. Should be one space for public
Pete Williamson 2012/08/19 22:05:14 Oops, my bad, I let the editor indent "public:" fo
+ PushMessagingGetChannelIdFunction();
+ virtual void OnObfuscatedGaiaIdFetchSuccess(
+ const std::string& access_token);
+ virtual void OnObfuscatedGaiaIdFetchFailure(
Munjal (Google) 2012/08/15 23:04:19 Move these methods to private once they are in the
Pete Williamson 2012/08/19 22:05:14 Noted. Will fix when we decide the right approach
+ const GoogleServiceAuthError& error);
+
+ protected:
+ virtual ~PushMessagingGetChannelIdFunction();
+
+ // ExtensionFunction:
+ virtual bool RunImpl() OVERRIDE;
+ DECLARE_EXTENSION_FUNCTION_NAME("experimental.pushMessaging.getChannelId");
+
+ private:
+ void GetChannelIdOnIOThread();
+ void RespondOnUIThread(const std::string& gaiaId, const long status);
+ void StartGaiaIdFetch(Profile* profile);
+ ObfuscatedGaiaIdFetcher* fetcher_;
+
+ DISALLOW_COPY_AND_ASSIGN(PushMessagingGetChannelIdFunction);
+};
+
} // namespace extension
#endif // CHROME_BROWSER_EXTENSIONS_API_PUSH_MESSAGING_PUSH_MESSAGING_API_H__

Powered by Google App Engine
This is Rietveld 408576698