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

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

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

Powered by Google App Engine
This is Rietveld 408576698