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

Side by Side Diff: chrome/browser/extensions/app_notify_channel_setup.cc

Issue 8633024: Switch end points to point to production (Closed) Base URL: http://src.chromium.org/svn/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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/common/chrome_switches.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/extensions/app_notify_channel_setup.h" 5 #include "chrome/browser/extensions/app_notify_channel_setup.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/json/json_reader.h" 10 #include "base/json/json_reader.h"
(...skipping 20 matching lines...) Expand all
31 using content::URLFetcher; 31 using content::URLFetcher;
32 32
33 namespace { 33 namespace {
34 static const char kChannelSetupAuthError[] = "unauthorized"; 34 static const char kChannelSetupAuthError[] = "unauthorized";
35 static const char kChannelSetupInternalError[] = "internal_error"; 35 static const char kChannelSetupInternalError[] = "internal_error";
36 static const char kChannelSetupCanceledByUser[] = "canceled_by_user"; 36 static const char kChannelSetupCanceledByUser[] = "canceled_by_user";
37 // TODO(munjal): Change these to use production URLs when we have them. 37 // TODO(munjal): Change these to use production URLs when we have them.
38 static const char kAuthorizationHeaderFormat[] = 38 static const char kAuthorizationHeaderFormat[] =
39 "Authorization: GoogleLogin auth=%s"; 39 "Authorization: GoogleLogin auth=%s";
40 static const char kOAuth2IssueTokenURL[] = 40 static const char kOAuth2IssueTokenURL[] =
41 "https://www-googleapis-staging.sandbox.google.com/oauth2/v2/IssueToken"; 41 "https://www.googleapis.com/oauth2/v2/IssueToken";
42 static const char kOAuth2IssueTokenBodyFormat[] = 42 static const char kOAuth2IssueTokenBodyFormat[] =
43 "force=true" 43 "force=true"
44 "&response_type=token" 44 "&response_type=token"
45 "&scope=%s" 45 "&scope=%s"
46 "&client_id=%s" 46 "&client_id=%s"
47 "&origin=%s"; 47 "&origin=%s";
48 static const char kOAuth2IssueTokenScope[] = 48 static const char kOAuth2IssueTokenScope[] =
49 "https://www.googleapis.com/auth/chromewebstore.notification"; 49 "https://www.googleapis.com/auth/chromewebstore.notification";
50 static const char kCWSChannelServiceURL[] = 50 static const char kCWSChannelServiceURL[] =
51 "https://www-googleapis-staging.sandbox.google.com/chromewebstore/" 51 "https://www.googleapis.com/chromewebstore/"
52 "v1internal/channels/app_id/oauth_client_id"; 52 "v1.1/channels/id";
53 static const char* kRelevantGaiaServices[] = { 53 static const char* kRelevantGaiaServices[] = {
54 GaiaConstants::kCWSService, 54 GaiaConstants::kCWSService,
55 GaiaConstants::kLSOService, 55 GaiaConstants::kLSOService,
56 }; 56 };
57 static const int kRelevantGaiaServicesCount = arraysize(kRelevantGaiaServices); 57 static const int kRelevantGaiaServicesCount = arraysize(kRelevantGaiaServices);
58 } // namespace. 58 } // namespace.
59 59
60 AppNotifyChannelSetup::AppNotifyChannelSetup( 60 AppNotifyChannelSetup::AppNotifyChannelSetup(
61 Profile* profile, 61 Profile* profile,
62 const std::string& extension_id, 62 const std::string& extension_id,
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 318
319 if (delegate_.get()) { 319 if (delegate_.get()) {
320 delegate_->AppNotifyChannelSetupComplete( 320 delegate_->AppNotifyChannelSetupComplete(
321 channel_id, error, return_route_id_, callback_id_); 321 channel_id, error, return_route_id_, callback_id_);
322 } 322 }
323 Release(); // Matches AddRef in Start. 323 Release(); // Matches AddRef in Start.
324 } 324 }
325 325
326 // static 326 // static
327 GURL AppNotifyChannelSetup::GetCWSChannelServiceURL() { 327 GURL AppNotifyChannelSetup::GetCWSChannelServiceURL() {
328 CommandLine* command_line = CommandLine::ForCurrentProcess();
329 if (command_line->HasSwitch(switches::kAppNotifyChannelServerURL)) {
330 std::string switch_value = command_line->GetSwitchValueASCII(
331 switches::kAppNotifyChannelServerURL);
332 GURL result(switch_value);
333 if (result.is_valid()) {
334 return result;
335 } else {
336 LOG(ERROR) << "Invalid value for " <<
337 switches::kAppNotifyChannelServerURL;
338 }
339 }
328 return GURL(kCWSChannelServiceURL); 340 return GURL(kCWSChannelServiceURL);
329 } 341 }
330 342
331 // static 343 // static
332 GURL AppNotifyChannelSetup::GetOAuth2IssueTokenURL() { 344 GURL AppNotifyChannelSetup::GetOAuth2IssueTokenURL() {
333 return GURL(kOAuth2IssueTokenURL); 345 return GURL(kOAuth2IssueTokenURL);
334 } 346 }
335 347
336 // static 348 // static
337 std::string AppNotifyChannelSetup::MakeOAuth2IssueTokenBody( 349 std::string AppNotifyChannelSetup::MakeOAuth2IssueTokenBody(
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 DictionaryValue* dict = static_cast<DictionaryValue*>(value.get()); 383 DictionaryValue* dict = static_cast<DictionaryValue*>(value.get());
372 if (!dict->Get("id", &channel_id_value)) 384 if (!dict->Get("id", &channel_id_value))
373 return false; 385 return false;
374 if (channel_id_value->GetType() != base::Value::TYPE_STRING) 386 if (channel_id_value->GetType() != base::Value::TYPE_STRING)
375 return false; 387 return false;
376 388
377 StringValue* channel_id = static_cast<StringValue*>(channel_id_value); 389 StringValue* channel_id = static_cast<StringValue*>(channel_id_value);
378 channel_id->GetAsString(result); 390 channel_id->GetAsString(result);
379 return true; 391 return true;
380 } 392 }
OLDNEW
« no previous file with comments | « no previous file | chrome/common/chrome_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698