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

Side by Side Diff: chrome/browser/chromeos/input_method/input_method_manager.cc

Issue 9956140: Add very minimum IBus-1.5 support to InputMethodManager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review Created 8 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/input_method/input_method_manager.h" 5 #include "chrome/browser/chromeos/input_method/input_method_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include <glib.h> 9 #include <glib.h>
10 10
(...skipping 18 matching lines...) Expand all
29 #include "content/public/browser/notification_service.h" 29 #include "content/public/browser/notification_service.h"
30 #include "content/public/browser/notification_types.h" 30 #include "content/public/browser/notification_types.h"
31 #include "googleurl/src/gurl.h" 31 #include "googleurl/src/gurl.h"
32 #include "ui/base/accelerators/accelerator.h" 32 #include "ui/base/accelerators/accelerator.h"
33 #include "unicode/uloc.h" 33 #include "unicode/uloc.h"
34 34
35 #if !defined(USE_VIRTUAL_KEYBOARD) 35 #if !defined(USE_VIRTUAL_KEYBOARD)
36 #include "chrome/browser/chromeos/input_method/candidate_window.h" 36 #include "chrome/browser/chromeos/input_method/candidate_window.h"
37 #endif 37 #endif
38 38
39 #if defined(HAVE_IBUS)
40 #include <ibus.h>
41 #endif
42
39 using content::BrowserThread; 43 using content::BrowserThread;
40 44
41 namespace { 45 namespace {
42 46
43 const char kIBusDaemonPath[] = "/usr/bin/ibus-daemon"; 47 const char kIBusDaemonPath[] = "/usr/bin/ibus-daemon";
44 48
45 // Finds a property which has |new_prop.key| from |prop_list|, and replaces the 49 // Finds a property which has |new_prop.key| from |prop_list|, and replaces the
46 // property with |new_prop|. Returns true if such a property is found. 50 // property with |new_prop|. Returns true if such a property is found.
47 bool FindAndUpdateProperty( 51 bool FindAndUpdateProperty(
48 const chromeos::input_method::InputMethodProperty& new_prop, 52 const chromeos::input_method::InputMethodProperty& new_prop,
(...skipping 716 matching lines...) Expand 10 before | Expand all | Expand 10 after
765 tentative_current_input_method_id_); 769 tentative_current_input_method_id_);
766 if (engine_iter != value.string_list_value.end()) { 770 if (engine_iter != value.string_list_value.end()) {
767 // Use std::rotate to keep the relative order of engines the same e.g. 771 // Use std::rotate to keep the relative order of engines the same e.g.
768 // from "A,B,C" to "C,A,B". 772 // from "A,B,C" to "C,A,B".
769 // We don't have to |active_input_method_ids_|, which decides the 773 // We don't have to |active_input_method_ids_|, which decides the
770 // order of engines in the switcher menu, since the relative order 774 // order of engines in the switcher menu, since the relative order
771 // of |value.string_list_value| is not changed. 775 // of |value.string_list_value| is not changed.
772 std::rotate(value.string_list_value.begin(), 776 std::rotate(value.string_list_value.begin(),
773 engine_iter, // this becomes the new first element 777 engine_iter, // this becomes the new first element
774 value.string_list_value.end()); 778 value.string_list_value.end());
779 #if defined(HAVE_IBUS)
780 #if IBUS_CHECK_VERSION(1, 4, 99)
781 ibus_controller_->ChangeInputMethod(*engine_iter);
kinaba 2012/04/13 06:16:50 You mean value.string_list_value[0]? The vector is
Yusuke Sato 2012/04/13 09:07:16 Done.
782 #endif
783 #endif
775 } else { 784 } else {
776 LOG(WARNING) << tentative_current_input_method_id_ 785 LOG(WARNING) << tentative_current_input_method_id_
777 << " is not in preload_engines: " << value.ToString(); 786 << " is not in preload_engines: " << value.ToString();
778 } 787 }
779 tentative_current_input_method_id_.erase(); 788 tentative_current_input_method_id_.erase();
780 } 789 }
781 790
782 if (ibus_controller_->SetInputMethodConfig(section, config_name, value)) { 791 if (ibus_controller_->SetInputMethodConfig(section, config_name, value)) {
783 // Check if it's a change in active input methods. 792 // Check if it's a change in active input methods.
784 if (config_name == language_prefs::kPreloadEnginesConfigName) { 793 if (config_name == language_prefs::kPreloadEnginesConfigName) {
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after
1263 DISALLOW_COPY_AND_ASSIGN(InputMethodManagerImpl); 1272 DISALLOW_COPY_AND_ASSIGN(InputMethodManagerImpl);
1264 }; 1273 };
1265 1274
1266 // static 1275 // static
1267 InputMethodManager* InputMethodManager::GetInstance() { 1276 InputMethodManager* InputMethodManager::GetInstance() {
1268 return InputMethodManagerImpl::GetInstance(); 1277 return InputMethodManagerImpl::GetInstance();
1269 } 1278 }
1270 1279
1271 } // namespace input_method 1280 } // namespace input_method
1272 } // namespace chromeos 1281 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698