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

Unified Diff: chrome/browser/extensions/app_notify_channel_setup.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: 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
Index: chrome/browser/extensions/app_notify_channel_setup.cc
diff --git a/chrome/browser/extensions/app_notify_channel_setup.cc b/chrome/browser/extensions/app_notify_channel_setup.cc
index 2e11a49ee14852d5afaab6d87cb96c10cc21b4c3..1253379a445f19b229858c4b6c51cba126174bb2 100644
--- a/chrome/browser/extensions/app_notify_channel_setup.cc
+++ b/chrome/browser/extensions/app_notify_channel_setup.cc
@@ -57,6 +57,15 @@ static const char* kRelevantGaiaServices[] = {
static const int kRelevantGaiaServicesCount = arraysize(kRelevantGaiaServices);
} // namespace.
+
Munjal (Google) 2011/11/29 21:55:34 Nit: remove extra newline.
asargent_no_longer_on_chrome 2011/11/30 06:06:20 Done. I also added spaces around the namespace op
+static AppNotifyChannelSetup::InterceptorForTests* g_interceptor = NULL;
Munjal (Google) 2011/11/29 21:55:34 Would it make more sense for this to be in anonymo
asargent_no_longer_on_chrome 2011/11/30 06:06:20 Good idea - moved into the anonymous namespace abo
+
+// static
+void AppNotifyChannelSetup::SetInterceptorForTests(
+ AppNotifyChannelSetup::InterceptorForTests* interceptor) {
+ g_interceptor = interceptor;
Munjal (Google) 2011/11/29 21:55:34 Nit: should we check that g_interceptor is NULL to
asargent_no_longer_on_chrome 2011/11/30 06:06:20 Good idea, done.
+}
+
AppNotifyChannelSetup::AppNotifyChannelSetup(
Profile* profile,
const std::string& extension_id,
@@ -81,6 +90,13 @@ AppNotifyChannelSetup::AppNotifyChannelSetup(
AppNotifyChannelSetup::~AppNotifyChannelSetup() {}
void AppNotifyChannelSetup::Start() {
+ if (g_interceptor) {
+ std::string channel_id;
+ std::string error;
+ g_interceptor->DoIntercept(this, &channel_id, &error);
+ delegate_->AppNotifyChannelSetupComplete(channel_id, error, this);
Munjal (Google) 2011/11/30 19:21:12 I am actually thinking if there is a way to avoid
asargent_no_longer_on_chrome 2011/11/30 19:45:21 Because this is used by a browser test, the entire
Munjal (Google) 2011/11/30 20:05:56 Thanks for the explanation. The interceptor approa
+ return;
+ }
AddRef(); // Balanced in ReportResult.
BeginLogin();
}
@@ -317,8 +333,7 @@ void AppNotifyChannelSetup::ReportResult(
CHECK(state_ == CHANNEL_ID_SETUP_DONE || state_ == ERROR_STATE);
if (delegate_.get()) {
- delegate_->AppNotifyChannelSetupComplete(
- channel_id, error, return_route_id_, callback_id_);
+ delegate_->AppNotifyChannelSetupComplete(channel_id, error, this);
}
Release(); // Matches AddRef in Start.
}

Powered by Google App Engine
This is Rietveld 408576698