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

Side by Side Diff: chrome/browser/supervised_user/child_accounts/permission_request_creator_apiary.cc

Issue 1028123002: Supervised users: Include extension version in update requests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: tests Created 5 years, 9 months 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/supervised_user/child_accounts/permission_request_creat or_apiary.h" 5 #include "chrome/browser/supervised_user/child_accounts/permission_request_creat or_apiary.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/json/json_reader.h" 9 #include "base/json/json_reader.h"
10 #include "base/json/json_writer.h" 10 #include "base/json/json_writer.h"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/strings/stringprintf.h" 12 #include "base/strings/stringprintf.h"
13 #include "base/values.h" 13 #include "base/values.h"
14 #include "base/version.h"
14 #include "chrome/browser/profiles/profile.h" 15 #include "chrome/browser/profiles/profile.h"
15 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" 16 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
16 #include "chrome/browser/signin/signin_manager_factory.h" 17 #include "chrome/browser/signin/signin_manager_factory.h"
17 #include "chrome/common/chrome_switches.h" 18 #include "chrome/common/chrome_switches.h"
18 #include "components/signin/core/browser/profile_oauth2_token_service.h" 19 #include "components/signin/core/browser/profile_oauth2_token_service.h"
19 #include "components/signin/core/browser/signin_manager.h" 20 #include "components/signin/core/browser/signin_manager.h"
20 #include "components/signin/core/browser/signin_manager_base.h" 21 #include "components/signin/core/browser/signin_manager_base.h"
21 #include "google_apis/gaia/google_service_auth_error.h" 22 #include "google_apis/gaia/google_service_auth_error.h"
22 #include "net/base/load_flags.h" 23 #include "net/base/load_flags.h"
23 #include "net/base/net_errors.h" 24 #include "net/base/net_errors.h"
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 } 112 }
112 113
113 void PermissionRequestCreatorApiary::CreateURLAccessRequest( 114 void PermissionRequestCreatorApiary::CreateURLAccessRequest(
114 const GURL& url_requested, 115 const GURL& url_requested,
115 const SuccessCallback& callback) { 116 const SuccessCallback& callback) {
116 CreateRequest(kNamespaceURLRequest, url_requested.spec(), callback); 117 CreateRequest(kNamespaceURLRequest, url_requested.spec(), callback);
117 } 118 }
118 119
119 void PermissionRequestCreatorApiary::CreateExtensionUpdateRequest( 120 void PermissionRequestCreatorApiary::CreateExtensionUpdateRequest(
120 const std::string& extension_id, 121 const std::string& extension_id,
122 const base::Version& version,
121 const SuccessCallback& callback) { 123 const SuccessCallback& callback) {
122 CreateRequest(kNamespaceUpdateRequest, extension_id, callback); 124 std::string object_ref = extension_id + ":" + version.GetString();
Bernhard Bauer 2015/03/23 16:18:39 BTW, is there a reason why this is part of the Per
Marc Treib 2015/03/23 16:26:46 I'd say it's only by coincidence that both PRC imp
Bernhard Bauer 2015/03/23 16:51:48 Really? IMO it's fair to say that what we are abst
Marc Treib 2015/03/24 14:48:03 Done.
125 CreateRequest(kNamespaceUpdateRequest, object_ref, callback);
123 } 126 }
124 127
125 GURL PermissionRequestCreatorApiary::GetApiUrl() const { 128 GURL PermissionRequestCreatorApiary::GetApiUrl() const {
126 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 129 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
127 switches::kPermissionRequestApiUrl)) { 130 switches::kPermissionRequestApiUrl)) {
128 GURL url(base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( 131 GURL url(base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
129 switches::kPermissionRequestApiUrl)); 132 switches::kPermissionRequestApiUrl));
130 LOG_IF(WARNING, !url.is_valid()) 133 LOG_IF(WARNING, !url.is_valid())
131 << "Got invalid URL for " << switches::kPermissionRequestApiUrl; 134 << "Got invalid URL for " << switches::kPermissionRequestApiUrl;
132 return url; 135 return url;
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 it, GoogleServiceAuthError::FromConnectionError(error_code)); 279 it, GoogleServiceAuthError::FromConnectionError(error_code));
277 } 280 }
278 281
279 void PermissionRequestCreatorApiary::DispatchGoogleServiceAuthError( 282 void PermissionRequestCreatorApiary::DispatchGoogleServiceAuthError(
280 RequestIterator it, 283 RequestIterator it,
281 const GoogleServiceAuthError& error) { 284 const GoogleServiceAuthError& error) {
282 VLOG(1) << "GoogleServiceAuthError: " << error.ToString(); 285 VLOG(1) << "GoogleServiceAuthError: " << error.ToString();
283 (*it)->callback.Run(false); 286 (*it)->callback.Run(false);
284 requests_.erase(it); 287 requests_.erase(it);
285 } 288 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698