Update broken references to image assets
[chromium-blink-merge.git] / chrome / browser / policy / policy_helpers.cc
bloba79640b76fdaa757f3f351ebb3d36c5769928318
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
3 // found in the LICENSE file.
5 #include "chrome/browser/policy/policy_helpers.h"
7 #include "net/base/net_errors.h"
8 #include "url/gurl.h"
10 #if defined(OS_CHROMEOS)
11 #include "base/command_line.h"
12 #include "chromeos/chromeos_switches.h"
13 #endif
15 #if !defined(OS_CHROMEOS) && !defined(OS_IOS)
16 #include "google_apis/gaia/gaia_urls.h"
17 #endif
19 namespace policy {
21 bool OverrideBlacklistForURL(const GURL& url, bool* block, int* reason) {
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 (base::CommandLine::ForCurrentProcess()->HasSwitch(
26 chromeos::switches::kOobeGuestSession)) {
27 if (!url.SchemeIs("chrome") && !url.SchemeIs("chrome-extension")) {
28 *reason = net::ERR_BLOCKED_ENROLLMENT_CHECK_PENDING;
29 *block = true;
30 return true;
33 return false;
34 #elif defined(OS_IOS)
35 return false;
36 #else
37 static const char kServiceLoginAuth[] = "/ServiceLoginAuth";
39 *block = false;
40 // Additionally whitelist /ServiceLoginAuth.
41 if (url.GetOrigin() != GaiaUrls::GetInstance()->gaia_url().GetOrigin())
42 return false;
44 return url.path() == kServiceLoginAuth;
45 #endif
48 } // namespace policy