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

Unified Diff: chrome/browser/chromeos/attestation/platform_verification_flow.cc

Issue 23470003: Implemented a switch for bypassing platform verification consent UI. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/chromeos/attestation/platform_verification_flow.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/attestation/platform_verification_flow.cc
diff --git a/chrome/browser/chromeos/attestation/platform_verification_flow.cc b/chrome/browser/chromeos/attestation/platform_verification_flow.cc
index f29a934948eb57db09be817119f5bf991d669fd5..81e6155f7eb9f3de2c625e9a1206a61fa0b8951d 100644
--- a/chrome/browser/chromeos/attestation/platform_verification_flow.cc
+++ b/chrome/browser/chromeos/attestation/platform_verification_flow.cc
@@ -4,6 +4,7 @@
#include "platform_verification_flow.h"
+#include "base/command_line.h"
#include "base/logging.h"
#include "base/prefs/pref_service.h"
#include "chrome/browser/chromeos/attestation/attestation_ca_client.h"
@@ -22,6 +23,11 @@
#include "content/public/browser/web_contents.h"
namespace {
+// A switch which allows consent to be given on the command line.
+// TODO(dkrahn): Remove this when UI has been implemented.
Mattias Nissler (ping if slow) 2013/09/06 13:40:21 nit: Can you reference the bug that tracks UI impl
Darren Krahn 2013/09/06 15:52:59 Done.
+const char kAutoApproveSwitch[] =
+ "auto-approve-platform-verification-consent-prompts";
+
// A callback method to handle DBus errors.
void DBusCallback(const base::Callback<void(bool)>& on_success,
const base::Closure& on_failure,
@@ -39,6 +45,48 @@ void DBusCallback(const base::Callback<void(bool)>& on_success,
namespace chromeos {
namespace attestation {
+// A default implementation of the Delegate interface.
+class DefaultDelegate : public PlatformVerificationFlow::Delegate {
+ public:
+ DefaultDelegate() {}
+ virtual ~DefaultDelegate() {}
+
+ virtual void ShowConsentPrompt(
+ PlatformVerificationFlow::ConsentType type,
+ content::WebContents* web_contents,
+ const PlatformVerificationFlow::Delegate::ConsentCallback& callback) {
+ if (CommandLine::ForCurrentProcess()->HasSwitch(kAutoApproveSwitch)) {
+ LOG(WARNING) << "PlatformVerificationFlow: Automatic approval enabled.";
+ callback.Run(PlatformVerificationFlow::CONSENT_RESPONSE_ALLOW);
+ } else {
+ LOG(ERROR) << "PlatformVerificationFlow: Consent prompt not implemented.";
Mattias Nissler (ping if slow) 2013/09/06 13:40:21 NOTIMPLEMENTED() might be the thing you're looking
Darren Krahn 2013/09/06 15:52:59 Done.
+ callback.Run(PlatformVerificationFlow::CONSENT_RESPONSE_NONE);
+ }
+ }
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(DefaultDelegate);
+};
+
+PlatformVerificationFlow::PlatformVerificationFlow()
+ : attestation_flow_(NULL),
+ async_caller_(cryptohome::AsyncMethodCaller::GetInstance()),
+ cryptohome_client_(DBusThreadManager::Get()->GetCryptohomeClient()),
+ user_manager_(UserManager::Get()),
+ delegate_(NULL),
+ testing_prefs_(NULL),
+ weak_factory_(this) {
+ DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
+ scoped_ptr<ServerProxy> attestation_ca_client(new AttestationCAClient());
+ default_attestation_flow_.reset(new AttestationFlow(
+ async_caller_,
+ cryptohome_client_,
+ attestation_ca_client.Pass()));
+ attestation_flow_ = default_attestation_flow_.get();
+ default_delegate_.reset(new DefaultDelegate());
+ delegate_ = default_delegate_.get();
+}
+
PlatformVerificationFlow::PlatformVerificationFlow(
AttestationFlow* attestation_flow,
cryptohome::AsyncMethodCaller* async_caller,
@@ -52,6 +100,7 @@ PlatformVerificationFlow::PlatformVerificationFlow(
user_manager_(user_manager),
statistics_provider_(statistics_provider),
delegate_(delegate),
+ testing_prefs_(NULL),
weak_factory_(this) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
}
« no previous file with comments | « chrome/browser/chromeos/attestation/platform_verification_flow.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698