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

Side by Side Diff: chrome/browser/chromeos/dom_ui/keyboard_overlay_ui.cc

Issue 5981001: Use libcros to convert input method ID to keyboard overlay ID. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 10 years 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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/dom_ui/keyboard_overlay_ui.h" 5 #include "chrome/browser/chromeos/dom_ui/keyboard_overlay_ui.h"
6 6
7 #include "app/l10n_util.h" 7 #include "app/l10n_util.h"
8 #include "app/resource_bundle.h" 8 #include "app/resource_bundle.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 return DOMMessageHandler::Attach(dom_ui); 262 return DOMMessageHandler::Attach(dom_ui);
263 } 263 }
264 264
265 void KeyboardOverlayHandler::RegisterMessages() { 265 void KeyboardOverlayHandler::RegisterMessages() {
266 DCHECK(dom_ui_); 266 DCHECK(dom_ui_);
267 dom_ui_->RegisterMessageCallback("getKeyboardOverlayId", 267 dom_ui_->RegisterMessageCallback("getKeyboardOverlayId",
268 NewCallback(this, &KeyboardOverlayHandler::GetKeyboardOverlayId)); 268 NewCallback(this, &KeyboardOverlayHandler::GetKeyboardOverlayId));
269 } 269 }
270 270
271 void KeyboardOverlayHandler::GetKeyboardOverlayId(const ListValue* args) { 271 void KeyboardOverlayHandler::GetKeyboardOverlayId(const ListValue* args) {
272 const chromeos::InputMethodLibrary* library = 272 chromeos::InputMethodLibrary* library =
satorux1 2011/01/05 03:42:29 You can get const back if you make GetKeyboardOver
mazda 2011/01/05 11:29:44 Ditto.
273 chromeos::CrosLibrary::Get()->GetInputMethodLibrary(); 273 chromeos::CrosLibrary::Get()->GetInputMethodLibrary();
274 const chromeos::InputMethodDescriptor& descriptor = 274 const chromeos::InputMethodDescriptor& descriptor =
275 library->current_input_method(); 275 library->current_input_method();
276 const std::string keyboard_overlay_id = 276 const std::string keyboard_overlay_id =
277 chromeos::input_method::GetKeyboardOverlayId(descriptor.id); 277 library->GetKeyboardOverlayId(descriptor.id);
278 StringValue param(keyboard_overlay_id); 278 StringValue param(keyboard_overlay_id);
279 dom_ui_->CallJavascriptFunction(L"initKeyboardOverlayId", param); 279 dom_ui_->CallJavascriptFunction(L"initKeyboardOverlayId", param);
280 } 280 }
281 281
282 //////////////////////////////////////////////////////////////////////////////// 282 ////////////////////////////////////////////////////////////////////////////////
283 // 283 //
284 // KeyboardOverlayUI 284 // KeyboardOverlayUI
285 // 285 //
286 //////////////////////////////////////////////////////////////////////////////// 286 ////////////////////////////////////////////////////////////////////////////////
287 287
288 KeyboardOverlayUI::KeyboardOverlayUI(TabContents* contents) 288 KeyboardOverlayUI::KeyboardOverlayUI(TabContents* contents)
289 : HtmlDialogUI(contents) { 289 : HtmlDialogUI(contents) {
290 KeyboardOverlayHandler* handler = new KeyboardOverlayHandler(); 290 KeyboardOverlayHandler* handler = new KeyboardOverlayHandler();
291 AddMessageHandler((handler)->Attach(this)); 291 AddMessageHandler((handler)->Attach(this));
292 KeyboardOverlayUIHTMLSource* html_source = new KeyboardOverlayUIHTMLSource(); 292 KeyboardOverlayUIHTMLSource* html_source = new KeyboardOverlayUIHTMLSource();
293 293
294 // Set up the chrome://keyboardoverlay/ source. 294 // Set up the chrome://keyboardoverlay/ source.
295 BrowserThread::PostTask( 295 BrowserThread::PostTask(
296 BrowserThread::IO, FROM_HERE, 296 BrowserThread::IO, FROM_HERE,
297 NewRunnableMethod( 297 NewRunnableMethod(
298 ChromeURLDataManager::GetInstance(), 298 ChromeURLDataManager::GetInstance(),
299 &ChromeURLDataManager::AddDataSource, 299 &ChromeURLDataManager::AddDataSource,
300 make_scoped_refptr(html_source))); 300 make_scoped_refptr(html_source)));
301 } 301 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698