| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/chromeos/login/signin/merge_session_throttling_utils.h" | 5 #include "chrome/browser/chromeos/login/signin/merge_session_throttling_utils.h" |
| 6 | 6 |
| 7 #include <stdint.h> |
| 8 |
| 7 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
| 8 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "base/macros.h" |
| 9 #include "base/memory/singleton.h" | 12 #include "base/memory/singleton.h" |
| 10 #include "base/threading/non_thread_safe.h" | 13 #include "base/threading/non_thread_safe.h" |
| 11 #include "base/time/time.h" | 14 #include "base/time/time.h" |
| 12 #include "chrome/browser/chromeos/login/signin/oauth2_login_manager.h" | 15 #include "chrome/browser/chromeos/login/signin/oauth2_login_manager.h" |
| 13 #include "chrome/browser/chromeos/login/signin/oauth2_login_manager_factory.h" | 16 #include "chrome/browser/chromeos/login/signin/oauth2_login_manager_factory.h" |
| 14 #include "chrome/common/url_constants.h" | 17 #include "chrome/common/url_constants.h" |
| 15 #include "components/google/core/browser/google_util.h" | 18 #include "components/google/core/browser/google_util.h" |
| 16 #include "components/user_manager/user_manager.h" | 19 #include "components/user_manager/user_manager.h" |
| 17 #include "content/public/browser/browser_thread.h" | 20 #include "content/public/browser/browser_thread.h" |
| 18 #include "content/public/browser/web_contents.h" | 21 #include "content/public/browser/web_contents.h" |
| 19 #include "net/base/network_change_notifier.h" | 22 #include "net/base/network_change_notifier.h" |
| 20 #include "url/gurl.h" | 23 #include "url/gurl.h" |
| 21 | 24 |
| 22 using content::BrowserThread; | 25 using content::BrowserThread; |
| 23 using content::WebContents; | 26 using content::WebContents; |
| 24 | 27 |
| 25 namespace merge_session_throttling_utils { | 28 namespace merge_session_throttling_utils { |
| 26 | 29 |
| 27 namespace { | 30 namespace { |
| 28 | 31 |
| 29 const int64 kMaxSessionRestoreTimeInSec = 60; | 32 const int64_t kMaxSessionRestoreTimeInSec = 60; |
| 30 | 33 |
| 31 // The set of blocked profiles. | 34 // The set of blocked profiles. |
| 32 class ProfileSet : public base::NonThreadSafe, public std::set<Profile*> { | 35 class ProfileSet : public base::NonThreadSafe, public std::set<Profile*> { |
| 33 public: | 36 public: |
| 34 ProfileSet() {} | 37 ProfileSet() {} |
| 35 | 38 |
| 36 virtual ~ProfileSet() {} | 39 virtual ~ProfileSet() {} |
| 37 | 40 |
| 38 static ProfileSet* Get(); | 41 static ProfileSet* Get(); |
| 39 | 42 |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 bool ShouldDelayUrl(const GURL& url) { | 170 bool ShouldDelayUrl(const GURL& url) { |
| 168 // If we are loading google properties while merge session is in progress, | 171 // If we are loading google properties while merge session is in progress, |
| 169 // we will show delayed loading page instead. | 172 // we will show delayed loading page instead. |
| 170 return !net::NetworkChangeNotifier::IsOffline() && | 173 return !net::NetworkChangeNotifier::IsOffline() && |
| 171 !AreAllSessionMergedAlready() && | 174 !AreAllSessionMergedAlready() && |
| 172 google_util::IsGoogleHostname(url.host(), | 175 google_util::IsGoogleHostname(url.host(), |
| 173 google_util::ALLOW_SUBDOMAIN); | 176 google_util::ALLOW_SUBDOMAIN); |
| 174 } | 177 } |
| 175 | 178 |
| 176 } // namespace merge_session_throttling_utils | 179 } // namespace merge_session_throttling_utils |
| OLD | NEW |