Add an experimental identity API for platform apps.

This adds a way for platform apps to access the user's signed into chrome account and generate an OAuth2 token:
 - chrome.experimental.identity.getAuthToken

BUG=none
TEST=ExtensionApiTest.Identity


Review URL: http://codereview.chromium.org/9474005

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@128591 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/chrome/common/extensions/extension.h b/chrome/common/extensions/extension.h
index 039a446..cf6a3fd 100644
--- a/chrome/common/extensions/extension.h
+++ b/chrome/common/extensions/extension.h
@@ -183,6 +183,15 @@
     std::set<std::string> event_types;
   };
 
+  // OAuth2 info included in the extension.
+  struct OAuth2Info {
+    OAuth2Info();
+    ~OAuth2Info();
+
+    std::string client_id;
+    std::vector<std::string> scopes;
+  };
+
   enum InitFromValueFlags {
     NO_FLAGS = 0,
 
@@ -591,6 +600,7 @@
   bool incognito_split_mode() const { return incognito_split_mode_; }
   bool offline_enabled() const { return offline_enabled_; }
   const std::vector<TtsVoice>& tts_voices() const { return tts_voices_; }
+  const OAuth2Info& oauth2_info() const { return oauth2_info_; }
   const std::vector<webkit_glue::WebIntentServiceData>&
       intents_services() const {
     return intents_services_;
@@ -802,6 +812,9 @@
   ExtensionAction* LoadExtensionActionHelper(
       const base::DictionaryValue* extension_action, string16* error);
 
+  // Helper method that loads the OAuth2 info from the 'oauth2' manifest key.
+  bool LoadOAuth2Info(string16* error);
+
   // Returns true if the extension has more than one "UI surface". For example,
   // an extension that has a browser action and a page action.
   bool HasMultipleUISurfaces() const;
@@ -1002,6 +1015,9 @@
   // List of text-to-speech voices that this extension provides, if any.
   std::vector<TtsVoice> tts_voices_;
 
+  // The OAuth2 client id and scopes, if specified by the extension.
+  OAuth2Info oauth2_info_;
+
   // List of intent services that this extension provides, if any.
   std::vector<webkit_glue::WebIntentServiceData> intents_services_;