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

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: 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
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..e87f6ceeba315435ca56258d600b7e9c6088ef31 100644
--- a/chrome/browser/extensions/app_notify_channel_setup.cc
+++ b/chrome/browser/extensions/app_notify_channel_setup.cc
@@ -31,6 +31,7 @@ using content::BrowserThread;
using content::URLFetcher;
namespace {
+
static const char kChannelSetupAuthError[] = "unauthorized";
static const char kChannelSetupInternalError[] = "internal_error";
static const char kChannelSetupCanceledByUser[] = "canceled_by_user";
@@ -55,8 +56,20 @@ static const char* kRelevantGaiaServices[] = {
GaiaConstants::kLSOService,
};
static const int kRelevantGaiaServicesCount = arraysize(kRelevantGaiaServices);
+
+static AppNotifyChannelSetup::InterceptorForTests* g_interceptor_for_tests =
+ NULL;
+
} // namespace.
+// static
+void AppNotifyChannelSetup::SetInterceptorForTests(
+ AppNotifyChannelSetup::InterceptorForTests* interceptor) {
+ // Only one interceptor at a time, please.
+ CHECK(g_interceptor_for_tests == NULL);
+ g_interceptor_for_tests = interceptor;
+}
+
AppNotifyChannelSetup::AppNotifyChannelSetup(
Profile* profile,
const std::string& extension_id,
@@ -81,6 +94,13 @@ AppNotifyChannelSetup::AppNotifyChannelSetup(
AppNotifyChannelSetup::~AppNotifyChannelSetup() {}
void AppNotifyChannelSetup::Start() {
+ if (g_interceptor_for_tests) {
+ std::string channel_id;
+ std::string error;
+ g_interceptor_for_tests->DoIntercept(this, &channel_id, &error);
+ delegate_->AppNotifyChannelSetupComplete(channel_id, error, this);
+ return;
+ }
AddRef(); // Balanced in ReportResult.
BeginLogin();
}
@@ -317,8 +337,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.
}
« no previous file with comments | « chrome/browser/extensions/app_notify_channel_setup.h ('k') | chrome/browser/extensions/app_notify_channel_setup_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698