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

Unified Diff: chrome/browser/extensions/extension_tab_helper.cc

Issue 8727024: Save the oauth client id used in App Notification setup (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixed nits Created 9 years, 1 month 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
« no previous file with comments | « chrome/browser/extensions/extension_tab_helper.h ('k') | chrome/chrome_tests.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/extension_tab_helper.cc
diff --git a/chrome/browser/extensions/extension_tab_helper.cc b/chrome/browser/extensions/extension_tab_helper.cc
index 1d1aa08fe0cc5773b4b056b836df1a6e041b24c4..25fe032a20ae6febb746252ab650236ef2ad4e9b 100644
--- a/chrome/browser/extensions/extension_tab_helper.cc
+++ b/chrome/browser/extensions/extension_tab_helper.cc
@@ -179,8 +179,8 @@ void ExtensionTabHelper::OnGetAppNotifyChannel(
ExtensionAPIPermission::kExperimental) &&
process_map->Contains(extension->id(), process->GetID());
if (!allowed) {
- AppNotifyChannelSetupComplete("", "permission_error", return_route_id,
- callback_id);
+ Send(new ExtensionMsg_GetAppNotifyChannelResponse(
+ return_route_id, "", "permission_error", callback_id));
return;
}
@@ -201,10 +201,23 @@ void ExtensionTabHelper::OnGetAppNotifyChannel(
}
void ExtensionTabHelper::AppNotifyChannelSetupComplete(
- const std::string& client_id, const std::string& error, int return_route_id,
- int callback_id) {
+ const std::string& channel_id,
+ const std::string& error,
+ const AppNotifyChannelSetup* setup) {
+ CHECK(setup);
+
+ // If the setup was successful, record that fact in ExtensionService.
+ if (!channel_id.empty() && error.empty()) {
+ Profile* profile =
+ Profile::FromBrowserContext(tab_contents()->browser_context());
+ ExtensionService* service = profile->GetExtensionService();
+ if (service->GetExtensionById(setup->extension_id(), true))
+ service->SetAppNotificationSetupDone(setup->extension_id(),
+ setup->client_id());
+ }
+
Send(new ExtensionMsg_GetAppNotifyChannelResponse(
- return_route_id, client_id, error, callback_id));
+ setup->return_route_id(), channel_id, error, setup->callback_id()));
}
void ExtensionTabHelper::OnRequest(
« no previous file with comments | « chrome/browser/extensions/extension_tab_helper.h ('k') | chrome/chrome_tests.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698