Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(987)

Side by Side Diff: chrome/browser/ui/webui/chromeos/login/terms_of_service_screen_handler.cc

Issue 2700303002: cros: Unify oobe View/Actor naming to just View. (Closed)
Patch Set: Rebase Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/ui/webui/chromeos/login/terms_of_service_screen_handler .h" 5 #include "chrome/browser/ui/webui/chromeos/login/terms_of_service_screen_handler .h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/bind_helpers.h" 11 #include "base/bind_helpers.h"
12 #include "base/strings/string_split.h" 12 #include "base/strings/string_split.h"
13 #include "base/values.h" 13 #include "base/values.h"
14 #include "chrome/browser/browser_process.h" 14 #include "chrome/browser/browser_process.h"
15 #include "chrome/browser/chromeos/base/locale_util.h" 15 #include "chrome/browser/chromeos/base/locale_util.h"
16 #include "chrome/browser/chromeos/login/screens/core_oobe_actor.h" 16 #include "chrome/browser/chromeos/login/screens/core_oobe_view.h"
17 #include "chrome/browser/chromeos/profiles/profile_helper.h" 17 #include "chrome/browser/chromeos/profiles/profile_helper.h"
18 #include "chrome/browser/profiles/profile.h" 18 #include "chrome/browser/profiles/profile.h"
19 #include "chrome/browser/profiles/profile_manager.h" 19 #include "chrome/browser/profiles/profile_manager.h"
20 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" 20 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h"
21 #include "chrome/common/pref_names.h" 21 #include "chrome/common/pref_names.h"
22 #include "chrome/grit/chromium_strings.h" 22 #include "chrome/grit/chromium_strings.h"
23 #include "chrome/grit/generated_resources.h" 23 #include "chrome/grit/generated_resources.h"
24 #include "components/login/localized_values_builder.h" 24 #include "components/login/localized_values_builder.h"
25 #include "components/prefs/pref_service.h" 25 #include "components/prefs/pref_service.h"
26 #include "components/user_manager/user.h" 26 #include "components/user_manager/user.h"
27 #include "components/user_manager/user_manager.h" 27 #include "components/user_manager/user_manager.h"
28 #include "content/public/browser/web_ui.h" 28 #include "content/public/browser/web_ui.h"
29 #include "ui/base/ime/chromeos/input_method_manager.h" 29 #include "ui/base/ime/chromeos/input_method_manager.h"
30 30
31 namespace { 31 namespace {
32 32
33 const char kJsScreenPath[] = "login.TermsOfServiceScreen"; 33 const char kJsScreenPath[] = "login.TermsOfServiceScreen";
34 34
35 } // namespace 35 } // namespace
36 36
37 namespace chromeos { 37 namespace chromeos {
38 38
39 TermsOfServiceScreenHandler::TermsOfServiceScreenHandler( 39 TermsOfServiceScreenHandler::TermsOfServiceScreenHandler(
40 CoreOobeActor* core_oobe_actor) 40 CoreOobeView* core_oobe_view)
41 : core_oobe_actor_(core_oobe_actor) { 41 : core_oobe_view_(core_oobe_view) {
42 set_call_js_prefix(kJsScreenPath); 42 set_call_js_prefix(kJsScreenPath);
43 } 43 }
44 44
45 TermsOfServiceScreenHandler::~TermsOfServiceScreenHandler() { 45 TermsOfServiceScreenHandler::~TermsOfServiceScreenHandler() {
46 if (screen_) 46 if (screen_)
47 screen_->OnActorDestroyed(this); 47 screen_->OnViewDestroyed(this);
48 } 48 }
49 49
50 void TermsOfServiceScreenHandler::RegisterMessages() { 50 void TermsOfServiceScreenHandler::RegisterMessages() {
51 AddCallback("termsOfServiceBack", 51 AddCallback("termsOfServiceBack",
52 &TermsOfServiceScreenHandler::HandleBack); 52 &TermsOfServiceScreenHandler::HandleBack);
53 AddCallback("termsOfServiceAccept", 53 AddCallback("termsOfServiceAccept",
54 &TermsOfServiceScreenHandler::HandleAccept); 54 &TermsOfServiceScreenHandler::HandleAccept);
55 } 55 }
56 56
57 void TermsOfServiceScreenHandler::DeclareLocalizedValues( 57 void TermsOfServiceScreenHandler::DeclareLocalizedValues(
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 Show(); 131 Show();
132 show_on_init_ = false; 132 show_on_init_ = false;
133 } 133 }
134 } 134 }
135 135
136 void TermsOfServiceScreenHandler::OnLanguageChangedCallback( 136 void TermsOfServiceScreenHandler::OnLanguageChangedCallback(
137 const locale_util::LanguageSwitchResult& result) { 137 const locale_util::LanguageSwitchResult& result) {
138 // Update the screen contents to the new locale. 138 // Update the screen contents to the new locale.
139 base::DictionaryValue localized_strings; 139 base::DictionaryValue localized_strings;
140 GetOobeUI()->GetLocalizedStrings(&localized_strings); 140 GetOobeUI()->GetLocalizedStrings(&localized_strings);
141 core_oobe_actor_->ReloadContent(localized_strings); 141 core_oobe_view_->ReloadContent(localized_strings);
142 142
143 DoShow(); 143 DoShow();
144 } 144 }
145 145
146 void TermsOfServiceScreenHandler::DoShow() { 146 void TermsOfServiceScreenHandler::DoShow() {
147 // Determine the user's most preferred input method. 147 // Determine the user's most preferred input method.
148 std::vector<std::string> input_methods = base::SplitString( 148 std::vector<std::string> input_methods = base::SplitString(
149 ProfileHelper::Get() 149 ProfileHelper::Get()
150 ->GetProfileByUserUnsafe( 150 ->GetProfileByUserUnsafe(
151 user_manager::UserManager::Get()->GetActiveUser()) 151 user_manager::UserManager::Get()->GetActiveUser())
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 // and continue" button should not be accessible. If the user managed to 204 // and continue" button should not be accessible. If the user managed to
205 // activate it somehow anway, do not treat this as acceptance of the Terms 205 // activate it somehow anway, do not treat this as acceptance of the Terms
206 // and Conditions and end the session instead, as if the user had declined. 206 // and Conditions and end the session instead, as if the user had declined.
207 if (terms_of_service_.empty()) 207 if (terms_of_service_.empty())
208 screen_->OnDecline(); 208 screen_->OnDecline();
209 else 209 else
210 screen_->OnAccept(); 210 screen_->OnAccept();
211 } 211 }
212 212
213 } // namespace chromeos 213 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698