OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/policy/url_blacklist_manager.h" | 5 #include "chrome/browser/policy/url_blacklist_manager.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
11 #include "base/strings/string_number_conversions.h" | 11 #include "base/strings/string_number_conversions.h" |
12 #include "base/values.h" | 12 #include "base/values.h" |
13 #include "chrome/browser/net/url_fixer_upper.h" | 13 #include "chrome/browser/net/url_fixer_upper.h" |
14 #include "chrome/browser/signin/signin_manager.h" | |
15 #include "chrome/common/chrome_notification_types.h" | 14 #include "chrome/common/chrome_notification_types.h" |
16 #include "chrome/common/pref_names.h" | 15 #include "chrome/common/pref_names.h" |
17 #include "components/user_prefs/pref_registry_syncable.h" | 16 #include "components/user_prefs/pref_registry_syncable.h" |
18 #include "content/public/browser/browser_thread.h" | 17 #include "content/public/browser/browser_thread.h" |
19 #include "content/public/browser/notification_details.h" | 18 #include "content/public/browser/notification_details.h" |
20 #include "content/public/browser/notification_source.h" | 19 #include "content/public/browser/notification_source.h" |
21 #include "google_apis/gaia/gaia_urls.h" | 20 #include "google_apis/gaia/gaia_urls.h" |
22 #include "googleurl/src/gurl.h" | 21 #include "googleurl/src/gurl.h" |
23 #include "net/base/load_flags.h" | 22 #include "net/base/load_flags.h" |
24 #include "net/url_request/url_request.h" | 23 #include "net/url_request/url_request.h" |
25 | 24 |
25 #if !defined(OS_CHROMEOS) | |
26 #include "chrome/browser/signin/signin_manager.h" | |
27 #endif | |
28 | |
26 using content::BrowserThread; | 29 using content::BrowserThread; |
27 using extensions::URLMatcher; | 30 using extensions::URLMatcher; |
28 using extensions::URLMatcherCondition; | 31 using extensions::URLMatcherCondition; |
29 using extensions::URLMatcherConditionFactory; | 32 using extensions::URLMatcherConditionFactory; |
30 using extensions::URLMatcherConditionSet; | 33 using extensions::URLMatcherConditionSet; |
31 using extensions::URLMatcherPortFilter; | 34 using extensions::URLMatcherPortFilter; |
32 using extensions::URLMatcherSchemeFilter; | 35 using extensions::URLMatcherSchemeFilter; |
33 | 36 |
34 namespace policy { | 37 namespace policy { |
35 | 38 |
(...skipping 16 matching lines...) Expand all Loading... | |
52 | 55 |
53 bool IsStandardScheme(const std::string& scheme) { | 56 bool IsStandardScheme(const std::string& scheme) { |
54 for (size_t i = 0; i < arraysize(kStandardSchemes); ++i) { | 57 for (size_t i = 0; i < arraysize(kStandardSchemes); ++i) { |
55 if (scheme == kStandardSchemes[i]) | 58 if (scheme == kStandardSchemes[i]) |
56 return true; | 59 return true; |
57 } | 60 } |
58 return false; | 61 return false; |
59 } | 62 } |
60 | 63 |
61 bool IsSigninFlowURL(const GURL& url) { | 64 bool IsSigninFlowURL(const GURL& url) { |
65 #if !defined(OS_CHROMEOS) | |
62 // Whitelist all the signin flow URLs flagged by the SigninManager. | 66 // Whitelist all the signin flow URLs flagged by the SigninManager. |
63 if (SigninManager::IsWebBasedSigninFlowURL(url)) | 67 if (SigninManager::IsWebBasedSigninFlowURL(url)) |
64 return true; | 68 return true; |
69 #endif | |
Roger Tawa OOO till Jul 10th
2013/04/05 20:53:57
Strange to ifdef out only this part. Is this func
tim (not reviewing)
2013/04/05 22:14:12
I'm not sure. CrOS still has a signin flow of its
Joao da Silva
2013/04/09 15:26:07
This function is only used in this file (it's in t
Andrew T Wilson (Slow)
2013/04/09 15:39:25
Good question. I've asked joao to check.
tim (not reviewing)
2013/04/16 03:28:29
Done.
tim (not reviewing)
2013/04/16 03:28:29
Done.
| |
65 | 70 |
66 // Additionally whitelist /ServiceLoginAuth. | 71 // Additionally whitelist /ServiceLoginAuth. |
67 if (url.GetOrigin() != GURL(GaiaUrls::GetInstance()->gaia_origin_url())) | 72 if (url.GetOrigin() != GURL(GaiaUrls::GetInstance()->gaia_origin_url())) |
68 return false; | 73 return false; |
69 return url.path() == kServiceLoginAuth; | 74 return url.path() == kServiceLoginAuth; |
70 } | 75 } |
71 | 76 |
72 // A task that builds the blacklist on the FILE thread. | 77 // A task that builds the blacklist on the FILE thread. |
73 scoped_ptr<URLBlacklist> BuildBlacklist(scoped_ptr<base::ListValue> block, | 78 scoped_ptr<URLBlacklist> BuildBlacklist(scoped_ptr<base::ListValue> block, |
74 scoped_ptr<base::ListValue> allow) { | 79 scoped_ptr<base::ListValue> allow) { |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
389 | 394 |
390 // static | 395 // static |
391 void URLBlacklistManager::RegisterUserPrefs(PrefRegistrySyncable* registry) { | 396 void URLBlacklistManager::RegisterUserPrefs(PrefRegistrySyncable* registry) { |
392 registry->RegisterListPref(prefs::kUrlBlacklist, | 397 registry->RegisterListPref(prefs::kUrlBlacklist, |
393 PrefRegistrySyncable::UNSYNCABLE_PREF); | 398 PrefRegistrySyncable::UNSYNCABLE_PREF); |
394 registry->RegisterListPref(prefs::kUrlWhitelist, | 399 registry->RegisterListPref(prefs::kUrlWhitelist, |
395 PrefRegistrySyncable::UNSYNCABLE_PREF); | 400 PrefRegistrySyncable::UNSYNCABLE_PREF); |
396 } | 401 } |
397 | 402 |
398 } // namespace policy | 403 } // namespace policy |
OLD | NEW |