| 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/signin/signin_manager.h" | 5 #include "chrome/browser/signin/signin_manager.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 #include "chrome/browser/signin/profile_oauth2_token_service.h" | 21 #include "chrome/browser/signin/profile_oauth2_token_service.h" |
| 22 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" | 22 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" |
| 23 #include "chrome/browser/signin/signin_account_id_helper.h" | 23 #include "chrome/browser/signin/signin_account_id_helper.h" |
| 24 #include "chrome/browser/signin/signin_global_error.h" | 24 #include "chrome/browser/signin/signin_global_error.h" |
| 25 #include "chrome/browser/signin/signin_internals_util.h" | 25 #include "chrome/browser/signin/signin_internals_util.h" |
| 26 #include "chrome/browser/signin/signin_manager_factory.h" | 26 #include "chrome/browser/signin/signin_manager_factory.h" |
| 27 #include "chrome/browser/ui/global_error/global_error_service.h" | 27 #include "chrome/browser/ui/global_error/global_error_service.h" |
| 28 #include "chrome/browser/ui/global_error/global_error_service_factory.h" | 28 #include "chrome/browser/ui/global_error/global_error_service_factory.h" |
| 29 #include "chrome/common/pref_names.h" | 29 #include "chrome/common/pref_names.h" |
| 30 #include "chrome/common/profile_management_switches.h" | 30 #include "chrome/common/profile_management_switches.h" |
| 31 #include "components/signin/core/signin_client.h" |
| 31 #include "components/signin/core/signin_manager_cookie_helper.h" | 32 #include "components/signin/core/signin_manager_cookie_helper.h" |
| 32 #include "components/signin/core/signin_manager_delegate.h" | |
| 33 #include "content/public/browser/browser_thread.h" | 33 #include "content/public/browser/browser_thread.h" |
| 34 #include "content/public/browser/notification_service.h" | 34 #include "content/public/browser/notification_service.h" |
| 35 #include "content/public/browser/render_process_host.h" | 35 #include "content/public/browser/render_process_host.h" |
| 36 #include "content/public/common/child_process_host.h" | 36 #include "content/public/common/child_process_host.h" |
| 37 #include "google_apis/gaia/gaia_auth_fetcher.h" | 37 #include "google_apis/gaia/gaia_auth_fetcher.h" |
| 38 #include "google_apis/gaia/gaia_auth_util.h" | 38 #include "google_apis/gaia/gaia_auth_util.h" |
| 39 #include "google_apis/gaia/gaia_constants.h" | 39 #include "google_apis/gaia/gaia_constants.h" |
| 40 #include "google_apis/gaia/gaia_urls.h" | 40 #include "google_apis/gaia/gaia_urls.h" |
| 41 #include "net/base/escape.h" | 41 #include "net/base/escape.h" |
| 42 #include "net/url_request/url_request_context.h" | 42 #include "net/url_request/url_request_context.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 return false; | 75 return false; |
| 76 | 76 |
| 77 // Any login UI URLs with signin=chromiumsync should be considered a web | 77 // Any login UI URLs with signin=chromiumsync should be considered a web |
| 78 // URL (relies on GAIA keeping the "service=chromiumsync" query string | 78 // URL (relies on GAIA keeping the "service=chromiumsync" query string |
| 79 // fragment present even when embedding inside a "continue" parameter). | 79 // fragment present even when embedding inside a "continue" parameter). |
| 80 return net::UnescapeURLComponent( | 80 return net::UnescapeURLComponent( |
| 81 url.query(), net::UnescapeRule::URL_SPECIAL_CHARS) | 81 url.query(), net::UnescapeRule::URL_SPECIAL_CHARS) |
| 82 .find(kChromiumSyncService) != std::string::npos; | 82 .find(kChromiumSyncService) != std::string::npos; |
| 83 } | 83 } |
| 84 | 84 |
| 85 SigninManager::SigninManager(scoped_ptr<SigninManagerDelegate> delegate) | 85 SigninManager::SigninManager(scoped_ptr<SigninClient> client) |
| 86 : prohibit_signout_(false), | 86 : prohibit_signout_(false), |
| 87 had_two_factor_error_(false), | 87 had_two_factor_error_(false), |
| 88 type_(SIGNIN_TYPE_NONE), | 88 type_(SIGNIN_TYPE_NONE), |
| 89 weak_pointer_factory_(this), | 89 weak_pointer_factory_(this), |
| 90 signin_host_id_(ChildProcessHost::kInvalidUniqueID), | 90 signin_host_id_(ChildProcessHost::kInvalidUniqueID), |
| 91 delegate_(delegate.Pass()) { | 91 client_(client.Pass()) {} |
| 92 } | |
| 93 | 92 |
| 94 void SigninManager::SetSigninProcess(int process_id) { | 93 void SigninManager::SetSigninProcess(int process_id) { |
| 95 if (process_id == signin_host_id_) | 94 if (process_id == signin_host_id_) |
| 96 return; | 95 return; |
| 97 DLOG_IF(WARNING, | 96 DLOG_IF(WARNING, |
| 98 signin_host_id_ != ChildProcessHost::kInvalidUniqueID) | 97 signin_host_id_ != ChildProcessHost::kInvalidUniqueID) |
| 99 << "Replacing in-use signin process."; | 98 << "Replacing in-use signin process."; |
| 100 signin_host_id_ = process_id; | 99 signin_host_id_ = process_id; |
| 101 RenderProcessHost* host = RenderProcessHost::FromID(process_id); | 100 RenderProcessHost* host = RenderProcessHost::FromID(process_id); |
| 102 DCHECK(host); | 101 DCHECK(host); |
| (...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 664 signin_host_id_ = ChildProcessHost::kInvalidUniqueID; | 663 signin_host_id_ = ChildProcessHost::kInvalidUniqueID; |
| 665 } | 664 } |
| 666 | 665 |
| 667 void SigninManager::ProhibitSignout(bool prohibit_signout) { | 666 void SigninManager::ProhibitSignout(bool prohibit_signout) { |
| 668 prohibit_signout_ = prohibit_signout; | 667 prohibit_signout_ = prohibit_signout; |
| 669 } | 668 } |
| 670 | 669 |
| 671 bool SigninManager::IsSignoutProhibited() const { | 670 bool SigninManager::IsSignoutProhibited() const { |
| 672 return prohibit_signout_; | 671 return prohibit_signout_; |
| 673 } | 672 } |
| OLD | NEW |