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

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

Issue 14208014: Simplify adding callbacks. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix, sync. 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"
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"
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 // OnLoadError() or the OnLoadSuccess() callback is called. 111 // OnLoadError() or the OnLoadSuccess() callback is called.
112 if (load_error_) { 112 if (load_error_) {
113 web_ui()->CallJavascriptFunction("cr.ui.Oobe.setTermsOfServiceLoadError"); 113 web_ui()->CallJavascriptFunction("cr.ui.Oobe.setTermsOfServiceLoadError");
114 } else if (!terms_of_service_.empty()) { 114 } else if (!terms_of_service_.empty()) {
115 base::StringValue terms_of_service(terms_of_service_); 115 base::StringValue terms_of_service(terms_of_service_);
116 web_ui()->CallJavascriptFunction("cr.ui.Oobe.setTermsOfService", 116 web_ui()->CallJavascriptFunction("cr.ui.Oobe.setTermsOfService",
117 terms_of_service); 117 terms_of_service);
118 } 118 }
119 } 119 }
120 120
121 void TermsOfServiceScreenHandler::HandleBack(const base::ListValue* args) { 121 void TermsOfServiceScreenHandler::HandleBack() {
122 if (screen_) 122 if (screen_)
123 screen_->OnDecline(); 123 screen_->OnDecline();
124 } 124 }
125 125
126 void TermsOfServiceScreenHandler::HandleAccept(const base::ListValue* args) { 126 void TermsOfServiceScreenHandler::HandleAccept() {
127 if (!screen_) 127 if (!screen_)
128 return; 128 return;
129 129
130 // If the Terms of Service have not been successfully downloaded, the "accept 130 // 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 131 // 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 132 // 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. 133 // and Conditions and end the session instead, as if the user had declined.
134 if (terms_of_service_.empty()) 134 if (terms_of_service_.empty())
135 screen_->OnDecline(); 135 screen_->OnDecline();
136 else 136 else
137 screen_->OnAccept(); 137 screen_->OnAccept();
138 } 138 }
139 139
140 } // namespace chromeos 140 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698