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

Side by Side Diff: chrome/browser/ui/ash/system_tray_delegate_chromeos.cc

Issue 150203015: Split out InputMethodMenuManager from InputMethodManager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 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 | « chrome/browser/ui/ash/system_tray_delegate_chromeos.h ('k') | chromeos/chromeos.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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/ash/system_tray_delegate_chromeos.h" 5 #include "chrome/browser/ui/ash/system_tray_delegate_chromeos.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "ash/ash_switches.h" 12 #include "ash/ash_switches.h"
13 #include "ash/desktop_background/desktop_background_controller.h" 13 #include "ash/desktop_background/desktop_background_controller.h"
14 #include "ash/ime/input_method_menu_item.h"
15 #include "ash/ime/input_method_menu_manager.h"
14 #include "ash/metrics/user_metrics_recorder.h" 16 #include "ash/metrics/user_metrics_recorder.h"
15 #include "ash/session_state_delegate.h" 17 #include "ash/session_state_delegate.h"
16 #include "ash/session_state_observer.h" 18 #include "ash/session_state_observer.h"
17 #include "ash/shell.h" 19 #include "ash/shell.h"
18 #include "ash/shell_delegate.h" 20 #include "ash/shell_delegate.h"
19 #include "ash/shell_window_ids.h" 21 #include "ash/shell_window_ids.h"
20 #include "ash/system/bluetooth/bluetooth_observer.h" 22 #include "ash/system/bluetooth/bluetooth_observer.h"
21 #include "ash/system/date/clock_observer.h" 23 #include "ash/system/date/clock_observer.h"
22 #include "ash/system/drive/drive_observer.h" 24 #include "ash/system/drive/drive_observer.h"
23 #include "ash/system/ime/ime_observer.h" 25 #include "ash/system/ime/ime_observer.h"
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 registrar_->Add( 293 registrar_->Add(
292 this, 294 this,
293 chrome::NOTIFICATION_CROS_ACCESSIBILITY_TOGGLE_VIRTUAL_KEYBOARD, 295 chrome::NOTIFICATION_CROS_ACCESSIBILITY_TOGGLE_VIRTUAL_KEYBOARD,
294 content::NotificationService::AllSources()); 296 content::NotificationService::AllSources());
295 } 297 }
296 298
297 void SystemTrayDelegateChromeOS::Initialize() { 299 void SystemTrayDelegateChromeOS::Initialize() {
298 DBusThreadManager::Get()->GetSessionManagerClient()->AddObserver(this); 300 DBusThreadManager::Get()->GetSessionManagerClient()->AddObserver(this);
299 301
300 input_method::InputMethodManager::Get()->AddObserver(this); 302 input_method::InputMethodManager::Get()->AddObserver(this);
303 ash::ime::InputMethodMenuManager::Get()->AddObserver(this);
301 UpdateClockType(); 304 UpdateClockType();
302 305
303 if (SystemKeyEventListener::GetInstance()) 306 if (SystemKeyEventListener::GetInstance())
304 SystemKeyEventListener::GetInstance()->AddCapsLockObserver(this); 307 SystemKeyEventListener::GetInstance()->AddCapsLockObserver(this);
305 308
306 device::BluetoothAdapterFactory::GetAdapter( 309 device::BluetoothAdapterFactory::GetAdapter(
307 base::Bind(&SystemTrayDelegateChromeOS::InitializeOnAdapterReady, 310 base::Bind(&SystemTrayDelegateChromeOS::InitializeOnAdapterReady,
308 weak_ptr_factory_.GetWeakPtr())); 311 weak_ptr_factory_.GetWeakPtr()));
309 312
310 ash::Shell::GetInstance()->session_state_delegate()->AddSessionStateObserver( 313 ash::Shell::GetInstance()->session_state_delegate()->AddSessionStateObserver(
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 SystemTrayDelegateChromeOS::~SystemTrayDelegateChromeOS() { 354 SystemTrayDelegateChromeOS::~SystemTrayDelegateChromeOS() {
352 // Unregister PrefChangeRegistrars. 355 // Unregister PrefChangeRegistrars.
353 local_state_registrar_.reset(); 356 local_state_registrar_.reset();
354 user_pref_registrar_.reset(); 357 user_pref_registrar_.reset();
355 358
356 // Unregister content notifications befure destroying any components. 359 // Unregister content notifications befure destroying any components.
357 registrar_.reset(); 360 registrar_.reset();
358 361
359 DBusThreadManager::Get()->GetSessionManagerClient()->RemoveObserver(this); 362 DBusThreadManager::Get()->GetSessionManagerClient()->RemoveObserver(this);
360 input_method::InputMethodManager::Get()->RemoveObserver(this); 363 input_method::InputMethodManager::Get()->RemoveObserver(this);
364 ash::ime::InputMethodMenuManager::Get()->RemoveObserver(this);
361 if (SystemKeyEventListener::GetInstance()) 365 if (SystemKeyEventListener::GetInstance())
362 SystemKeyEventListener::GetInstance()->RemoveCapsLockObserver(this); 366 SystemKeyEventListener::GetInstance()->RemoveCapsLockObserver(this);
363 bluetooth_adapter_->RemoveObserver(this); 367 bluetooth_adapter_->RemoveObserver(this);
364 ash::Shell::GetInstance() 368 ash::Shell::GetInstance()
365 ->session_state_delegate() 369 ->session_state_delegate()
366 ->RemoveSessionStateObserver(this); 370 ->RemoveSessionStateObserver(this);
367 LoginState::Get()->RemoveObserver(this); 371 LoginState::Get()->RemoveObserver(this);
368 372
369 // Stop observing Drive operations. 373 // Stop observing Drive operations.
370 UnobserveDriveUpdates(); 374 UnobserveDriveUpdates();
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after
755 input_method::InputMethodDescriptor& ime = ime_descriptors->at(i); 759 input_method::InputMethodDescriptor& ime = ime_descriptors->at(i);
756 ash::IMEInfo info; 760 ash::IMEInfo info;
757 ExtractIMEInfo(ime, *util, &info); 761 ExtractIMEInfo(ime, *util, &info);
758 info.selected = ime.id() == current; 762 info.selected = ime.id() == current;
759 list->push_back(info); 763 list->push_back(info);
760 } 764 }
761 } 765 }
762 766
763 void SystemTrayDelegateChromeOS::GetCurrentIMEProperties( 767 void SystemTrayDelegateChromeOS::GetCurrentIMEProperties(
764 ash::IMEPropertyInfoList* list) { 768 ash::IMEPropertyInfoList* list) {
765 input_method::InputMethodManager* manager = 769 ash::ime::InputMethodMenuItemList menu_list =
766 input_method::InputMethodManager::Get(); 770 ash::ime::InputMethodMenuManager::Get()->
767 input_method::InputMethodPropertyList properties = 771 GetCurrentInputMethodMenuItemList();
768 manager->GetCurrentInputMethodProperties(); 772 for (size_t i = 0; i < menu_list.size(); ++i) {
769 for (size_t i = 0; i < properties.size(); ++i) {
770 ash::IMEPropertyInfo property; 773 ash::IMEPropertyInfo property;
771 property.key = properties[i].key; 774 property.key = menu_list[i].key;
772 property.name = base::UTF8ToUTF16(properties[i].label); 775 property.name = base::UTF8ToUTF16(menu_list[i].label);
773 property.selected = properties[i].is_selection_item_checked; 776 property.selected = menu_list[i].is_selection_item_checked;
774 list->push_back(property); 777 list->push_back(property);
775 } 778 }
776 } 779 }
777 780
778 void SystemTrayDelegateChromeOS::SwitchIME(const std::string& ime_id) { 781 void SystemTrayDelegateChromeOS::SwitchIME(const std::string& ime_id) {
779 input_method::InputMethodManager::Get()->ChangeInputMethod(ime_id); 782 input_method::InputMethodManager::Get()->ChangeInputMethod(ime_id);
780 } 783 }
781 784
782 void SystemTrayDelegateChromeOS::ActivateIMEProperty(const std::string& key) { 785 void SystemTrayDelegateChromeOS::ActivateIMEProperty(const std::string& key) {
783 input_method::InputMethodManager::Get()->ActivateInputMethodProperty(key); 786 input_method::InputMethodManager::Get()->ActivateInputMethodMenuItem(key);
784 } 787 }
785 788
786 void SystemTrayDelegateChromeOS::CancelDriveOperation(int32 operation_id) { 789 void SystemTrayDelegateChromeOS::CancelDriveOperation(int32 operation_id) {
787 DriveIntegrationService* integration_service = FindDriveIntegrationService(); 790 DriveIntegrationService* integration_service = FindDriveIntegrationService();
788 if (!integration_service) 791 if (!integration_service)
789 return; 792 return;
790 793
791 integration_service->job_list()->CancelJob(operation_id); 794 integration_service->job_list()->CancelJob(operation_id);
792 } 795 }
793 796
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after
1190 // |show_message| in ash means the message_center notifications 1193 // |show_message| in ash means the message_center notifications
1191 // which should not be shown unless kDisableIMEModeIndicator is 1194 // which should not be shown unless kDisableIMEModeIndicator is
1192 // on, since the mode indicator already notifies the user. 1195 // on, since the mode indicator already notifies the user.
1193 if (!CommandLine::ForCurrentProcess()->HasSwitch( 1196 if (!CommandLine::ForCurrentProcess()->HasSwitch(
1194 switches::kDisableIMEModeIndicator)) { 1197 switches::kDisableIMEModeIndicator)) {
1195 show_message = false; 1198 show_message = false;
1196 } 1199 }
1197 GetSystemTrayNotifier()->NotifyRefreshIME(show_message); 1200 GetSystemTrayNotifier()->NotifyRefreshIME(show_message);
1198 } 1201 }
1199 1202
1200 void SystemTrayDelegateChromeOS::InputMethodPropertyChanged( 1203 // Overridden from InputMethodMenuManager::Observer.
1201 input_method::InputMethodManager* manager) { 1204 void SystemTrayDelegateChromeOS::InputMethodMenuItemChanged(
1205 ash::ime::InputMethodMenuManager* manager) {
1202 GetSystemTrayNotifier()->NotifyRefreshIME(false); 1206 GetSystemTrayNotifier()->NotifyRefreshIME(false);
1203 } 1207 }
1204 1208
1205 // drive::JobListObserver overrides. 1209 // drive::JobListObserver overrides.
1206 void SystemTrayDelegateChromeOS::OnJobAdded(const drive::JobInfo& job_info) { 1210 void SystemTrayDelegateChromeOS::OnJobAdded(const drive::JobInfo& job_info) {
1207 OnJobUpdated(job_info); 1211 OnJobUpdated(job_info);
1208 } 1212 }
1209 1213
1210 void SystemTrayDelegateChromeOS::OnJobDone(const drive::JobInfo& job_info, 1214 void SystemTrayDelegateChromeOS::OnJobDone(const drive::JobInfo& job_info,
1211 drive::FileError error) { 1215 drive::FileError error) {
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
1297 void SystemTrayDelegateChromeOS::UserAddedToSession( 1301 void SystemTrayDelegateChromeOS::UserAddedToSession(
1298 const std::string& user_id) { 1302 const std::string& user_id) {
1299 GetSystemTrayNotifier()->NotifyUserAddedToSession(); 1303 GetSystemTrayNotifier()->NotifyUserAddedToSession();
1300 } 1304 }
1301 1305
1302 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { 1306 ash::SystemTrayDelegate* CreateSystemTrayDelegate() {
1303 return new SystemTrayDelegateChromeOS(); 1307 return new SystemTrayDelegateChromeOS();
1304 } 1308 }
1305 1309
1306 } // namespace chromeos 1310 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/ui/ash/system_tray_delegate_chromeos.h ('k') | chromeos/chromeos.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698