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

Side by Side Diff: chrome/browser/ui/webui/options/chromeos/cros_language_options_handler.cc

Issue 9003014: Replace WebUI::tab_contents() with web_contents() and switch all users to use web_contents.h inst... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 8 years, 11 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/options/chromeos/cros_language_options_handler .h" 5 #include "chrome/browser/ui/webui/options/chromeos/cros_language_options_handler .h"
6 6
7 #include <map> 7 #include <map>
8 #include <set> 8 #include <set>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/bind_helpers.h" 12 #include "base/bind_helpers.h"
13 #include "base/stringprintf.h" 13 #include "base/stringprintf.h"
14 #include "base/utf_string_conversions.h" 14 #include "base/utf_string_conversions.h"
15 #include "base/values.h" 15 #include "base/values.h"
16 #include "chrome/app/chrome_command_ids.h" 16 #include "chrome/app/chrome_command_ids.h"
17 #include "chrome/browser/browser_process.h" 17 #include "chrome/browser/browser_process.h"
18 #include "chrome/browser/chromeos/input_method/input_method_manager.h" 18 #include "chrome/browser/chromeos/input_method/input_method_manager.h"
19 #include "chrome/browser/chromeos/input_method/input_method_util.h" 19 #include "chrome/browser/chromeos/input_method/input_method_util.h"
20 #include "chrome/browser/profiles/profile.h" 20 #include "chrome/browser/profiles/profile.h"
21 #include "chrome/browser/ui/browser.h" 21 #include "chrome/browser/ui/browser.h"
22 #include "content/browser/tab_contents/tab_contents.h"
23 #include "content/public/browser/user_metrics.h" 22 #include "content/public/browser/user_metrics.h"
23 #include "content/public/browser/web_contents.h"
24 #include "grit/chromium_strings.h" 24 #include "grit/chromium_strings.h"
25 #include "grit/generated_resources.h" 25 #include "grit/generated_resources.h"
26 #include "ui/base/l10n/l10n_util.h" 26 #include "ui/base/l10n/l10n_util.h"
27 27
28 using content::UserMetricsAction; 28 using content::UserMetricsAction;
29 29
30 namespace chromeos { 30 namespace chromeos {
31 31
32 CrosLanguageOptionsHandler::CrosLanguageOptionsHandler() { 32 CrosLanguageOptionsHandler::CrosLanguageOptionsHandler() {
33 } 33 }
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 void CrosLanguageOptionsHandler::SetApplicationLocale( 205 void CrosLanguageOptionsHandler::SetApplicationLocale(
206 const std::string& language_code) { 206 const std::string& language_code) {
207 Profile::FromWebUI(web_ui())->ChangeAppLocale( 207 Profile::FromWebUI(web_ui())->ChangeAppLocale(
208 language_code, Profile::APP_LOCALE_CHANGED_VIA_SETTINGS); 208 language_code, Profile::APP_LOCALE_CHANGED_VIA_SETTINGS);
209 } 209 }
210 210
211 void CrosLanguageOptionsHandler::RestartCallback(const ListValue* args) { 211 void CrosLanguageOptionsHandler::RestartCallback(const ListValue* args) {
212 content::RecordAction(UserMetricsAction("LanguageOptions_SignOut")); 212 content::RecordAction(UserMetricsAction("LanguageOptions_SignOut"));
213 213
214 Browser* browser = Browser::GetBrowserForController( 214 Browser* browser = Browser::GetBrowserForController(
215 &web_ui()->tab_contents()->GetController(), NULL); 215 &web_ui()->web_contents()->GetController(), NULL);
216 if (browser) 216 if (browser)
217 browser->ExecuteCommand(IDC_EXIT); 217 browser->ExecuteCommand(IDC_EXIT);
218 } 218 }
219 219
220 void CrosLanguageOptionsHandler::InputMethodDisableCallback( 220 void CrosLanguageOptionsHandler::InputMethodDisableCallback(
221 const ListValue* args) { 221 const ListValue* args) {
222 const std::string input_method_id = UTF16ToASCII(ExtractStringValue(args)); 222 const std::string input_method_id = UTF16ToASCII(ExtractStringValue(args));
223 const std::string action = base::StringPrintf( 223 const std::string action = base::StringPrintf(
224 "LanguageOptions_DisableInputMethod_%s", input_method_id.c_str()); 224 "LanguageOptions_DisableInputMethod_%s", input_method_id.c_str());
225 content::RecordComputedAction(action); 225 content::RecordComputedAction(action);
226 } 226 }
227 227
228 void CrosLanguageOptionsHandler::InputMethodEnableCallback( 228 void CrosLanguageOptionsHandler::InputMethodEnableCallback(
229 const ListValue* args) { 229 const ListValue* args) {
230 const std::string input_method_id = UTF16ToASCII(ExtractStringValue(args)); 230 const std::string input_method_id = UTF16ToASCII(ExtractStringValue(args));
231 const std::string action = base::StringPrintf( 231 const std::string action = base::StringPrintf(
232 "LanguageOptions_EnableInputMethod_%s", input_method_id.c_str()); 232 "LanguageOptions_EnableInputMethod_%s", input_method_id.c_str());
233 content::RecordComputedAction(action); 233 content::RecordComputedAction(action);
234 } 234 }
235 235
236 void CrosLanguageOptionsHandler::InputMethodOptionsOpenCallback( 236 void CrosLanguageOptionsHandler::InputMethodOptionsOpenCallback(
237 const ListValue* args) { 237 const ListValue* args) {
238 const std::string input_method_id = UTF16ToASCII(ExtractStringValue(args)); 238 const std::string input_method_id = UTF16ToASCII(ExtractStringValue(args));
239 const std::string action = base::StringPrintf( 239 const std::string action = base::StringPrintf(
240 "InputMethodOptions_Open_%s", input_method_id.c_str()); 240 "InputMethodOptions_Open_%s", input_method_id.c_str());
241 content::RecordComputedAction(action); 241 content::RecordComputedAction(action);
242 } 242 }
243 243
244 } // namespace chromeos 244 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698