OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/chromeos/login/screens/terms_of_service_screen.h" | 5 #include "chrome/browser/chromeos/login/screens/terms_of_service_screen.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/location.h" | 9 #include "base/location.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "base/prefs/pref_service.h" | 11 #include "base/prefs/pref_service.h" |
12 #include "base/time.h" | 12 #include "base/time.h" |
13 #include "chrome/browser/browser_process.h" | 13 #include "chrome/browser/browser_process.h" |
14 #include "chrome/browser/chromeos/login/screens/screen_observer.h" | 14 #include "chrome/browser/chromeos/login/screens/screen_observer.h" |
15 #include "chrome/browser/chromeos/login/user.h" | 15 #include "chrome/browser/chromeos/login/user.h" |
16 #include "chrome/browser/chromeos/login/user_manager.h" | 16 #include "chrome/browser/chromeos/login/user_manager.h" |
17 #include "chrome/browser/chromeos/login/wizard_controller.h" | 17 #include "chrome/browser/chromeos/login/wizard_controller.h" |
| 18 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
18 #include "chrome/browser/profiles/profile.h" | 19 #include "chrome/browser/profiles/profile.h" |
19 #include "chrome/browser/profiles/profile_manager.h" | |
20 #include "chrome/common/pref_names.h" | 20 #include "chrome/common/pref_names.h" |
21 #include "google_apis/gaia/gaia_auth_util.h" | 21 #include "google_apis/gaia/gaia_auth_util.h" |
22 #include "googleurl/src/gurl.h" | 22 #include "googleurl/src/gurl.h" |
23 #include "net/http/http_response_headers.h" | 23 #include "net/http/http_response_headers.h" |
24 #include "net/url_request/url_fetcher.h" | 24 #include "net/url_request/url_fetcher.h" |
25 #include "net/url_request/url_request_context_getter.h" | 25 #include "net/url_request/url_request_context_getter.h" |
26 #include "net/url_request/url_request_status.h" | 26 #include "net/url_request/url_request_status.h" |
27 | 27 |
28 namespace chromeos { | 28 namespace chromeos { |
29 | 29 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 void TermsOfServiceScreen::OnAccept() { | 75 void TermsOfServiceScreen::OnAccept() { |
76 get_screen_observer()->OnExit(ScreenObserver::TERMS_OF_SERVICE_ACCEPTED); | 76 get_screen_observer()->OnExit(ScreenObserver::TERMS_OF_SERVICE_ACCEPTED); |
77 } | 77 } |
78 | 78 |
79 void TermsOfServiceScreen::OnActorDestroyed(TermsOfServiceScreenActor* actor) { | 79 void TermsOfServiceScreen::OnActorDestroyed(TermsOfServiceScreenActor* actor) { |
80 if (actor_ == actor) | 80 if (actor_ == actor) |
81 actor_ = NULL; | 81 actor_ = NULL; |
82 } | 82 } |
83 | 83 |
84 void TermsOfServiceScreen::StartDownload() { | 84 void TermsOfServiceScreen::StartDownload() { |
85 const PrefService* prefs = ProfileManager::GetDefaultProfile()->GetPrefs(); | 85 const PrefService* prefs = ProfileHelper::GetSigninProfile()->GetPrefs(); |
86 // If an URL from which the Terms of Service can be downloaded has not been | 86 // If an URL from which the Terms of Service can be downloaded has not been |
87 // set, show an error message to the user. | 87 // set, show an error message to the user. |
88 std::string terms_of_service_url = | 88 std::string terms_of_service_url = |
89 prefs->GetString(prefs::kTermsOfServiceURL); | 89 prefs->GetString(prefs::kTermsOfServiceURL); |
90 if (terms_of_service_url.empty()) { | 90 if (terms_of_service_url.empty()) { |
91 if (actor_) | 91 if (actor_) |
92 actor_->OnLoadError(); | 92 actor_->OnLoadError(); |
93 return; | 93 return; |
94 } | 94 } |
95 | 95 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 !source->GetResponseAsString(&terms_of_service)) { | 143 !source->GetResponseAsString(&terms_of_service)) { |
144 actor_->OnLoadError(); | 144 actor_->OnLoadError(); |
145 } else { | 145 } else { |
146 // If the Terms of Service were downloaded successfully, show them to the | 146 // If the Terms of Service were downloaded successfully, show them to the |
147 // user. | 147 // user. |
148 actor_->OnLoadSuccess(terms_of_service); | 148 actor_->OnLoadSuccess(terms_of_service); |
149 } | 149 } |
150 } | 150 } |
151 | 151 |
152 } // namespace chromeos | 152 } // namespace chromeos |
OLD | NEW |