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

Side by Side Diff: extensions/browser/api/vpn_provider/vpn_service.cc

Issue 1014053002: Provide warning message for setParameters (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Print only when there is a warning and fix unittest error 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 "extensions/browser/api/vpn_provider/vpn_service.h" 5 #include "extensions/browser/api/vpn_provider/vpn_service.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 network_configuration_handler_->RemoveConfiguration( 369 network_configuration_handler_->RemoveConfiguration(
370 service_path, NetworkConfigurationObserver::SOURCE_EXTENSION_INSTALL, 370 service_path, NetworkConfigurationObserver::SOURCE_EXTENSION_INSTALL,
371 base::Bind(&VpnService::OnRemoveConfigurationSuccess, 371 base::Bind(&VpnService::OnRemoveConfigurationSuccess,
372 weak_factory_.GetWeakPtr(), success), 372 weak_factory_.GetWeakPtr(), success),
373 base::Bind(&VpnService::OnRemoveConfigurationFailure, 373 base::Bind(&VpnService::OnRemoveConfigurationFailure,
374 weak_factory_.GetWeakPtr(), failure)); 374 weak_factory_.GetWeakPtr(), failure));
375 } 375 }
376 376
377 void VpnService::SetParameters(const std::string& extension_id, 377 void VpnService::SetParameters(const std::string& extension_id,
378 const base::DictionaryValue& parameters, 378 const base::DictionaryValue& parameters,
379 const SuccessCallback& success, 379 const StringCallback& success,
380 const FailureCallback& failure) { 380 const FailureCallback& failure) {
381 if (!DoesActiveConfigurationExistAndIsAccessAuthorized(extension_id)) { 381 if (!DoesActiveConfigurationExistAndIsAccessAuthorized(extension_id)) {
382 failure.Run(std::string(), std::string("Unauthorized access.")); 382 failure.Run(std::string(), std::string("Unauthorized access."));
383 return; 383 return;
384 } 384 }
385 385
386 shill_client_->SetParameters(active_configuration_->object_path(), parameters, 386 shill_client_->SetParameters(active_configuration_->object_path(), parameters,
387 success, failure); 387 success, failure);
388 } 388 }
389 389
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
543 delete configuration; 543 delete configuration;
544 } 544 }
545 545
546 bool VpnService::DoesActiveConfigurationExistAndIsAccessAuthorized( 546 bool VpnService::DoesActiveConfigurationExistAndIsAccessAuthorized(
547 const std::string& extension_id) { 547 const std::string& extension_id) {
548 return active_configuration_ && 548 return active_configuration_ &&
549 active_configuration_->extension_id() == extension_id; 549 active_configuration_->extension_id() == extension_id;
550 } 550 }
551 551
552 } // namespace chromeos 552 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698