OLD | NEW |
---|---|
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "chrome/browser/managed_mode/managed_user_service.h" | 5 #include "chrome/browser/managed_mode/managed_user_service.h" |
6 | 6 |
7 #include "base/memory/ref_counted.h" | 7 #include "base/memory/ref_counted.h" |
8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
9 #include "base/sequenced_task_runner.h" | 9 #include "base/sequenced_task_runner.h" |
10 #include "chrome/browser/extensions/extension_service.h" | 10 #include "chrome/browser/extensions/extension_service.h" |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
122 return observer ? observer->is_elevated() : false; | 122 return observer ? observer->is_elevated() : false; |
123 } | 123 } |
124 | 124 |
125 bool ManagedUserService::IsPassphraseEmpty() const { | 125 bool ManagedUserService::IsPassphraseEmpty() const { |
126 PrefService* pref_service = profile_->GetPrefs(); | 126 PrefService* pref_service = profile_->GetPrefs(); |
127 return pref_service->GetString(prefs::kManagedModeLocalPassphrase).empty(); | 127 return pref_service->GetString(prefs::kManagedModeLocalPassphrase).empty(); |
128 } | 128 } |
129 | 129 |
130 bool ManagedUserService::CanSkipPassphraseDialog( | 130 bool ManagedUserService::CanSkipPassphraseDialog( |
131 const content::WebContents* web_contents) const { | 131 const content::WebContents* web_contents) const { |
132 #if defined(OS_CHROMEOS) | |
133 return false; | |
Adrian Kuegel
2013/04/11 15:56:10
I could add a DCHECK here, too, if I modify the co
| |
134 #endif | |
132 return IsElevatedForWebContents(web_contents) || | 135 return IsElevatedForWebContents(web_contents) || |
133 IsPassphraseEmpty(); | 136 IsPassphraseEmpty(); |
134 } | 137 } |
135 | 138 |
136 void ManagedUserService::RequestAuthorization( | 139 void ManagedUserService::RequestAuthorization( |
137 content::WebContents* web_contents, | 140 content::WebContents* web_contents, |
138 const PassphraseCheckedCallback& callback) { | 141 const PassphraseCheckedCallback& callback) { |
142 #if defined(OS_CHROMEOS) | |
143 callback.Run(false); | |
Bernhard Bauer
2013/04/11 13:31:18
Again, should we maybe DCHECK?
Adrian Kuegel
2013/04/11 15:56:10
If I add a DCHECK here, I would have to also chang
| |
144 return; | |
145 #endif | |
146 | |
139 if (CanSkipPassphraseDialog(web_contents)) { | 147 if (CanSkipPassphraseDialog(web_contents)) { |
140 callback.Run(true); | 148 callback.Run(true); |
141 return; | 149 return; |
142 } | 150 } |
143 | 151 |
144 // Is deleted automatically when the dialog is closed. | 152 // Is deleted automatically when the dialog is closed. |
145 new ManagedUserPassphraseDialog(web_contents, callback); | 153 new ManagedUserPassphraseDialog(web_contents, callback); |
146 } | 154 } |
147 | 155 |
148 // static | 156 // static |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
406 profile_->GetPrefs()->GetDictionary(prefs::kManagedModeManualURLs); | 414 profile_->GetPrefs()->GetDictionary(prefs::kManagedModeManualURLs); |
407 for (DictionaryValue::Iterator it(*dict); !it.IsAtEnd(); it.Advance()) { | 415 for (DictionaryValue::Iterator it(*dict); !it.IsAtEnd(); it.Advance()) { |
408 GURL url(it.key()); | 416 GURL url(it.key()); |
409 if (url.host() == host) | 417 if (url.host() == host) |
410 urls->push_back(url); | 418 urls->push_back(url); |
411 } | 419 } |
412 } | 420 } |
413 | 421 |
414 void ManagedUserService::AddElevationForExtension( | 422 void ManagedUserService::AddElevationForExtension( |
415 const std::string& extension_id) { | 423 const std::string& extension_id) { |
424 #if !defined(OS_CHROMEOS) | |
416 elevated_for_extensions_.insert(extension_id); | 425 elevated_for_extensions_.insert(extension_id); |
Bernhard Bauer
2013/04/11 13:31:18
And here
| |
426 #endif | |
417 } | 427 } |
418 | 428 |
419 void ManagedUserService::RemoveElevationForExtension( | 429 void ManagedUserService::RemoveElevationForExtension( |
420 const std::string& extension_id) { | 430 const std::string& extension_id) { |
431 #if !defined(OS_CHROMEOS) | |
421 elevated_for_extensions_.erase(extension_id); | 432 elevated_for_extensions_.erase(extension_id); |
Bernhard Bauer
2013/04/11 13:31:18
And here
| |
433 #endif | |
422 } | 434 } |
423 | 435 |
424 void ManagedUserService::Init() { | 436 void ManagedUserService::Init() { |
425 if (!ProfileIsManaged()) | 437 if (!ProfileIsManaged()) |
426 return; | 438 return; |
427 | 439 |
428 extensions::ExtensionSystem* extension_system = | 440 extensions::ExtensionSystem* extension_system = |
429 extensions::ExtensionSystem::Get(profile_); | 441 extensions::ExtensionSystem::Get(profile_); |
430 extensions::ManagementPolicy* management_policy = | 442 extensions::ManagementPolicy* management_policy = |
431 extension_system->management_policy(); | 443 extension_system->management_policy(); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
479 profile_->GetPrefs()->GetDictionary(prefs::kManagedModeManualURLs); | 491 profile_->GetPrefs()->GetDictionary(prefs::kManagedModeManualURLs); |
480 scoped_ptr<std::map<GURL, bool> > url_map(new std::map<GURL, bool>()); | 492 scoped_ptr<std::map<GURL, bool> > url_map(new std::map<GURL, bool>()); |
481 for (DictionaryValue::Iterator it(*dict); !it.IsAtEnd(); it.Advance()) { | 493 for (DictionaryValue::Iterator it(*dict); !it.IsAtEnd(); it.Advance()) { |
482 bool allow = false; | 494 bool allow = false; |
483 bool result = it.value().GetAsBoolean(&allow); | 495 bool result = it.value().GetAsBoolean(&allow); |
484 DCHECK(result); | 496 DCHECK(result); |
485 (*url_map)[GURL(it.key())] = allow; | 497 (*url_map)[GURL(it.key())] = allow; |
486 } | 498 } |
487 url_filter_context_.SetManualURLs(url_map.Pass()); | 499 url_filter_context_.SetManualURLs(url_map.Pass()); |
488 } | 500 } |
OLD | NEW |