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

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

Issue 14063018: Implemented argument wrapping for CallJS. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Get rid of macro. Created 7 years, 8 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 | Annotate | Revision Log
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 "base/values.h" 7 #include "base/values.h"
bartfab (slow) 2013/04/18 07:39:31 Nit: No longer used.
ygorshenin1 2013/04/18 07:58:23 Done.
8 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" 8 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h"
9 #include "grit/chromium_strings.h" 9 #include "grit/chromium_strings.h"
10 #include "grit/generated_resources.h" 10 #include "grit/generated_resources.h"
11 11
12 namespace chromeos { 12 namespace chromeos {
13 13
14 TermsOfServiceScreenHandler::TermsOfServiceScreenHandler() 14 TermsOfServiceScreenHandler::TermsOfServiceScreenHandler()
15 : screen_(NULL), 15 : screen_(NULL),
16 show_on_init_(false), 16 show_on_init_(false),
17 load_error_(false) { 17 load_error_(false) {
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 } 87 }
88 88
89 void TermsOfServiceScreenHandler::Initialize() { 89 void TermsOfServiceScreenHandler::Initialize() {
90 if (show_on_init_) { 90 if (show_on_init_) {
91 Show(); 91 Show();
92 show_on_init_ = false; 92 show_on_init_ = false;
93 } 93 }
94 } 94 }
95 95
96 void TermsOfServiceScreenHandler::UpdateDomainInUI() { 96 void TermsOfServiceScreenHandler::UpdateDomainInUI() {
97 if (!page_is_ready()) 97 if (page_is_ready())
98 return; 98 CallJS("cr.ui.Oobe.setTermsOfServiceDomain", domain_);
99
100 base::StringValue domain(domain_);
101 CallJS("cr.ui.Oobe.setTermsOfServiceDomain", domain);
102 } 99 }
103 100
104 void TermsOfServiceScreenHandler::UpdateTermsOfServiceInUI() { 101 void TermsOfServiceScreenHandler::UpdateTermsOfServiceInUI() {
105 if (!page_is_ready()) 102 if (!page_is_ready())
106 return; 103 return;
107 104
108 // If either |load_error_| or |terms_of_service_| is set, the download of the 105 // If either |load_error_| or |terms_of_service_| is set, the download of the
109 // Terms of Service has completed and the UI should be updated. Otherwise, the 106 // Terms of Service has completed and the UI should be updated. Otherwise, the
110 // download is still in progress and the UI will be updated when the 107 // download is still in progress and the UI will be updated when the
111 // OnLoadError() or the OnLoadSuccess() callback is called. 108 // OnLoadError() or the OnLoadSuccess() callback is called.
112 if (load_error_) { 109 if (load_error_)
113 web_ui()->CallJavascriptFunction("cr.ui.Oobe.setTermsOfServiceLoadError"); 110 CallJS("cr.ui.Oobe.setTermsOfServiceLoadError");
114 } else if (!terms_of_service_.empty()) { 111 else if (!terms_of_service_.empty())
115 base::StringValue terms_of_service(terms_of_service_); 112 CallJS("cr.ui.Oobe.setTermsOfService", terms_of_service_);
116 web_ui()->CallJavascriptFunction("cr.ui.Oobe.setTermsOfService",
117 terms_of_service);
118 }
119 } 113 }
120 114
121 void TermsOfServiceScreenHandler::HandleBack() { 115 void TermsOfServiceScreenHandler::HandleBack() {
122 if (screen_) 116 if (screen_)
123 screen_->OnDecline(); 117 screen_->OnDecline();
124 } 118 }
125 119
126 void TermsOfServiceScreenHandler::HandleAccept() { 120 void TermsOfServiceScreenHandler::HandleAccept() {
127 if (!screen_) 121 if (!screen_)
128 return; 122 return;
129 123
130 // If the Terms of Service have not been successfully downloaded, the "accept 124 // If the Terms of Service have not been successfully downloaded, the "accept
131 // and continue" button should not be accessible. If the user managed to 125 // and continue" button should not be accessible. If the user managed to
132 // activate it somehow anway, do not treat this as acceptance of the Terms 126 // activate it somehow anway, do not treat this as acceptance of the Terms
133 // and Conditions and end the session instead, as if the user had declined. 127 // and Conditions and end the session instead, as if the user had declined.
134 if (terms_of_service_.empty()) 128 if (terms_of_service_.empty())
135 screen_->OnDecline(); 129 screen_->OnDecline();
136 else 130 else
137 screen_->OnAccept(); 131 screen_->OnAccept();
138 } 132 }
139 133
140 } // namespace chromeos 134 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698