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

Side by Side Diff: chrome/browser/chromeos/attestation/platform_verification_flow.cc

Issue 27399004: Removed the implementation of CheckPlatformState. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 2 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "platform_verification_flow.h" 5 #include "platform_verification_flow.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/prefs/pref_service.h" 9 #include "base/prefs/pref_service.h"
10 #include "chrome/browser/chromeos/attestation/attestation_ca_client.h" 10 #include "chrome/browser/chromeos/attestation/attestation_ca_client.h"
11 #include "chrome/browser/chromeos/attestation/attestation_signed_data.pb.h" 11 #include "chrome/browser/chromeos/attestation/attestation_signed_data.pb.h"
12 #include "chrome/browser/chromeos/attestation/platform_verification_dialog.h" 12 #include "chrome/browser/chromeos/attestation/platform_verification_dialog.h"
13 #include "chrome/browser/chromeos/login/user_manager.h" 13 #include "chrome/browser/chromeos/login/user_manager.h"
14 #include "chrome/browser/chromeos/settings/cros_settings.h" 14 #include "chrome/browser/chromeos/settings/cros_settings.h"
15 #include "chrome/browser/prefs/scoped_user_pref_update.h" 15 #include "chrome/browser/prefs/scoped_user_pref_update.h"
16 #include "chrome/common/pref_names.h" 16 #include "chrome/common/pref_names.h"
17 #include "chromeos/attestation/attestation_flow.h" 17 #include "chromeos/attestation/attestation_flow.h"
18 #include "chromeos/cryptohome/async_method_caller.h" 18 #include "chromeos/cryptohome/async_method_caller.h"
19 #include "chromeos/dbus/cryptohome_client.h" 19 #include "chromeos/dbus/cryptohome_client.h"
20 #include "chromeos/dbus/dbus_thread_manager.h" 20 #include "chromeos/dbus/dbus_thread_manager.h"
21 #include "chromeos/system/statistics_provider.h"
22 #include "components/user_prefs/pref_registry_syncable.h" 21 #include "components/user_prefs/pref_registry_syncable.h"
23 #include "components/user_prefs/user_prefs.h" 22 #include "components/user_prefs/user_prefs.h"
24 #include "content/public/browser/browser_thread.h" 23 #include "content/public/browser/browser_thread.h"
25 #include "content/public/browser/user_metrics.h" 24 #include "content/public/browser/user_metrics.h"
26 #include "content/public/browser/web_contents.h" 25 #include "content/public/browser/web_contents.h"
27 26
28 namespace { 27 namespace {
29 // A switch which allows consent to be given on the command line. 28 // A switch which allows consent to be given on the command line.
30 // TODO(dkrahn): Remove this when UI has been implemented (crbug.com/270908). 29 // TODO(dkrahn): Remove this when UI has been implemented (crbug.com/270908).
31 const char kAutoApproveSwitch[] = 30 const char kAutoApproveSwitch[] =
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 76
78 private: 77 private:
79 DISALLOW_COPY_AND_ASSIGN(DefaultDelegate); 78 DISALLOW_COPY_AND_ASSIGN(DefaultDelegate);
80 }; 79 };
81 80
82 PlatformVerificationFlow::PlatformVerificationFlow() 81 PlatformVerificationFlow::PlatformVerificationFlow()
83 : attestation_flow_(NULL), 82 : attestation_flow_(NULL),
84 async_caller_(cryptohome::AsyncMethodCaller::GetInstance()), 83 async_caller_(cryptohome::AsyncMethodCaller::GetInstance()),
85 cryptohome_client_(DBusThreadManager::Get()->GetCryptohomeClient()), 84 cryptohome_client_(DBusThreadManager::Get()->GetCryptohomeClient()),
86 user_manager_(UserManager::Get()), 85 user_manager_(UserManager::Get()),
87 statistics_provider_(system::StatisticsProvider::GetInstance()),
88 delegate_(NULL), 86 delegate_(NULL),
89 testing_prefs_(NULL), 87 testing_prefs_(NULL),
90 weak_factory_(this) { 88 weak_factory_(this) {
91 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); 89 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
92 scoped_ptr<ServerProxy> attestation_ca_client(new AttestationCAClient()); 90 scoped_ptr<ServerProxy> attestation_ca_client(new AttestationCAClient());
93 default_attestation_flow_.reset(new AttestationFlow( 91 default_attestation_flow_.reset(new AttestationFlow(
94 async_caller_, 92 async_caller_,
95 cryptohome_client_, 93 cryptohome_client_,
96 attestation_ca_client.Pass())); 94 attestation_ca_client.Pass()));
97 attestation_flow_ = default_attestation_flow_.get(); 95 attestation_flow_ = default_attestation_flow_.get();
98 default_delegate_.reset(new DefaultDelegate()); 96 default_delegate_.reset(new DefaultDelegate());
99 delegate_ = default_delegate_.get(); 97 delegate_ = default_delegate_.get();
100 } 98 }
101 99
102 PlatformVerificationFlow::PlatformVerificationFlow( 100 PlatformVerificationFlow::PlatformVerificationFlow(
103 AttestationFlow* attestation_flow, 101 AttestationFlow* attestation_flow,
104 cryptohome::AsyncMethodCaller* async_caller, 102 cryptohome::AsyncMethodCaller* async_caller,
105 CryptohomeClient* cryptohome_client, 103 CryptohomeClient* cryptohome_client,
106 UserManager* user_manager, 104 UserManager* user_manager,
107 system::StatisticsProvider* statistics_provider,
108 Delegate* delegate) 105 Delegate* delegate)
109 : attestation_flow_(attestation_flow), 106 : attestation_flow_(attestation_flow),
110 async_caller_(async_caller), 107 async_caller_(async_caller),
111 cryptohome_client_(cryptohome_client), 108 cryptohome_client_(cryptohome_client),
112 user_manager_(user_manager), 109 user_manager_(user_manager),
113 statistics_provider_(statistics_provider),
114 delegate_(delegate), 110 delegate_(delegate),
115 testing_prefs_(NULL), 111 testing_prefs_(NULL),
116 weak_factory_(this) { 112 weak_factory_(this) {
117 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); 113 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
118 } 114 }
119 115
120 PlatformVerificationFlow::~PlatformVerificationFlow() { 116 PlatformVerificationFlow::~PlatformVerificationFlow() {
121 } 117 }
122 118
123 void PlatformVerificationFlow::ChallengePlatformKey( 119 void PlatformVerificationFlow::ChallengePlatformKey(
(...skipping 15 matching lines...) Expand all
139 service_id, 135 service_id,
140 challenge, 136 challenge,
141 callback), 137 callback),
142 base::Bind(&ReportError, callback, INTERNAL_ERROR)); 138 base::Bind(&ReportError, callback, INTERNAL_ERROR));
143 cryptohome_client_->TpmAttestationIsEnrolled(dbus_callback); 139 cryptohome_client_->TpmAttestationIsEnrolled(dbus_callback);
144 } 140 }
145 141
146 void PlatformVerificationFlow::CheckPlatformState( 142 void PlatformVerificationFlow::CheckPlatformState(
147 const base::Callback<void(bool result)>& callback) { 143 const base::Callback<void(bool result)>& callback) {
148 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); 144 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
149 std::string stat_value; 145 // The implementation of this method has been removed for two reasons:
150 if (!statistics_provider_->GetMachineStatistic(system::kDevSwitchBootMode, 146 // 1. It may be wrong and when it is a poor UX will follow.
151 &stat_value)) { 147 // 2. It leaks platform state information which should stay internal.
152 LOG(ERROR) << __func__ << ": Failed to get boot mode statistic."; 148 // TODO(dkrahn): Remove the method once all callers have been cleaned up.
153 callback.Run(false); 149 // crbug.com/307707
154 return; 150 callback.Run(true);
155 }
156 if (stat_value != "0") {
157 LOG(INFO) << __func__ << ": Statistic indicates developer mode.";
158 callback.Run(false);
159 return;
160 }
161 BoolDBusMethodCallback dbus_callback = base::Bind(
162 &DBusCallback,
163 callback,
164 base::Bind(callback, false));
165 cryptohome_client_->TpmAttestationIsPrepared(dbus_callback);
166 } 151 }
167 152
168 void PlatformVerificationFlow::CheckConsent(content::WebContents* web_contents, 153 void PlatformVerificationFlow::CheckConsent(content::WebContents* web_contents,
169 const std::string& service_id, 154 const std::string& service_id,
170 const std::string& challenge, 155 const std::string& challenge,
171 const ChallengeCallback& callback, 156 const ChallengeCallback& callback,
172 bool attestation_enrolled) { 157 bool attestation_enrolled) {
173 ConsentType consent_type = CONSENT_TYPE_NONE; 158 ConsentType consent_type = CONSENT_TYPE_NONE;
174 if (!attestation_enrolled || IsFirstUse(web_contents)) { 159 if (!attestation_enrolled || IsFirstUse(web_contents)) {
175 consent_type = CONSENT_TYPE_ATTESTATION; 160 consent_type = CONSENT_TYPE_ATTESTATION;
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 bool allow_domain) { 406 bool allow_domain) {
422 PrefService* pref_service = GetPrefs(web_contents); 407 PrefService* pref_service = GetPrefs(web_contents);
423 CHECK(pref_service); 408 CHECK(pref_service);
424 DictionaryPrefUpdate updater(pref_service, prefs::kRAConsentDomains); 409 DictionaryPrefUpdate updater(pref_service, prefs::kRAConsentDomains);
425 const GURL& url = GetURL(web_contents); 410 const GURL& url = GetURL(web_contents);
426 updater->SetBoolean(url.host(), allow_domain); 411 updater->SetBoolean(url.host(), allow_domain);
427 } 412 }
428 413
429 } // namespace attestation 414 } // namespace attestation
430 } // namespace chromeos 415 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698