OLD | NEW |
---|---|
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 "chrome/browser/policy/policy_helpers.h" | 5 #include "chrome/browser/policy/policy_helpers.h" |
6 | 6 |
7 #include "url/gurl.h" | 7 #include "url/gurl.h" |
8 | 8 |
9 #if defined(OS_CHROMEOS) | |
10 #include "base/command_line.h" | |
11 #include "chromeos/chromeos_switches.h" | |
12 #endif | |
13 | |
9 #if !defined(OS_CHROMEOS) && !defined(OS_IOS) | 14 #if !defined(OS_CHROMEOS) && !defined(OS_IOS) |
10 #include "chrome/browser/signin/signin_manager.h" | 15 #include "chrome/browser/signin/signin_manager.h" |
11 #include "google_apis/gaia/gaia_urls.h" | 16 #include "google_apis/gaia/gaia_urls.h" |
12 #endif | 17 #endif |
13 | 18 |
14 namespace policy { | 19 namespace policy { |
15 | 20 |
16 bool OverrideBlacklistForURL(const GURL& url, bool* block) { | 21 bool OverrideBlacklistForURL(const GURL& url, bool* block) { |
17 #if defined(OS_CHROMEOS) || defined(OS_IOS) | 22 #if defined(OS_CHROMEOS) |
23 // On ChromeOS browsing is only allowed once OOBE has completed. Therefore all | |
24 // requests are blocked until this condition is met. | |
25 if (CommandLine::ForCurrentProcess()->HasSwitch( | |
26 chromeos::switches::kOobeGuestSession)) { | |
Mattias Nissler (ping if slow)
2014/03/25 14:20:45
Is this indentation legit? My gut feeling is +4
| |
27 if (url.SchemeIs("http") || url.SchemeIs("https") || url.SchemeIs("ftp")) { | |
Mattias Nissler (ping if slow)
2014/03/25 14:20:45
So you're still blacklisting stuff? Didn't we deci
| |
28 *block = true; | |
29 return true; | |
30 } | |
31 } | |
32 return false; | |
33 #elif defined(OS_IOS) | |
18 return false; | 34 return false; |
19 #else | 35 #else |
20 static const char kServiceLoginAuth[] = "/ServiceLoginAuth"; | 36 static const char kServiceLoginAuth[] = "/ServiceLoginAuth"; |
21 | 37 |
22 *block = false; | 38 *block = false; |
23 // Whitelist all the signin flow URLs flagged by the SigninManager. | 39 // Whitelist all the signin flow URLs flagged by the SigninManager. |
24 if (SigninManager::IsWebBasedSigninFlowURL(url)) | 40 if (SigninManager::IsWebBasedSigninFlowURL(url)) |
25 return true; | 41 return true; |
26 | 42 |
27 // Additionally whitelist /ServiceLoginAuth. | 43 // Additionally whitelist /ServiceLoginAuth. |
28 if (url.GetOrigin() != GaiaUrls::GetInstance()->gaia_url().GetOrigin()) | 44 if (url.GetOrigin() != GaiaUrls::GetInstance()->gaia_url().GetOrigin()) |
29 return false; | 45 return false; |
30 | 46 |
31 return url.path() == kServiceLoginAuth; | 47 return url.path() == kServiceLoginAuth; |
32 #endif | 48 #endif |
33 } | 49 } |
34 | 50 |
35 } // namespace policy | 51 } // namespace policy |
OLD | NEW |