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

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

Issue 11466010: Decompose BrowserStateMonitor into two parts, simplifying unit tests and APIs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix gypi ordering. Created 8 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) 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_impl.h" 5 #include "chrome/browser/chromeos/input_method/input_method_manager_impl.h"
6 6
7 #include <algorithm> // std::find 7 #include <algorithm> // std::find
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "base/string_util.h" 11 #include "base/string_util.h"
12 #include "base/stringprintf.h" 12 #include "base/stringprintf.h"
13 #include "chrome/browser/chromeos/input_method/browser_state_monitor.h"
14 #include "chrome/browser/chromeos/input_method/candidate_window_controller.h" 13 #include "chrome/browser/chromeos/input_method/candidate_window_controller.h"
15 #include "chrome/browser/chromeos/input_method/input_method_delegate.h" 14 #include "chrome/browser/chromeos/input_method/input_method_delegate.h"
16 #include "chrome/browser/chromeos/input_method/input_method_engine_ibus.h" 15 #include "chrome/browser/chromeos/input_method/input_method_engine_ibus.h"
17 #include "chrome/browser/chromeos/input_method/xkeyboard.h" 16 #include "chrome/browser/chromeos/input_method/xkeyboard.h"
18 #include "chrome/browser/chromeos/language_preferences.h" 17 #include "chrome/browser/chromeos/language_preferences.h"
19 #include "ui/base/accelerators/accelerator.h" 18 #include "ui/base/accelerators/accelerator.h"
20 #include "unicode/uloc.h" 19 #include "unicode/uloc.h"
21 20
22 namespace chromeos { 21 namespace chromeos {
23 namespace input_method { 22 namespace input_method {
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 break; 75 break;
77 case STATE_BROWSER_SCREEN: 76 case STATE_BROWSER_SCREEN:
78 if (old_state == STATE_LOCK_SCREEN) 77 if (old_state == STATE_LOCK_SCREEN)
79 OnScreenUnlocked(); 78 OnScreenUnlocked();
80 break; 79 break;
81 case STATE_LOCK_SCREEN: 80 case STATE_LOCK_SCREEN:
82 OnScreenLocked(); 81 OnScreenLocked();
83 break; 82 break;
84 case STATE_TERMINATING: { 83 case STATE_TERMINATING: {
85 ibus_controller_->Stop(); 84 ibus_controller_->Stop();
86 browser_state_monitor_.reset(); // For crbug.com/120183.
87 if (candidate_window_controller_.get()) { 85 if (candidate_window_controller_.get()) {
88 candidate_window_controller_->Shutdown(ibus_controller_.get()); 86 candidate_window_controller_->Shutdown(ibus_controller_.get());
89 candidate_window_controller_.reset(); 87 candidate_window_controller_.reset();
90 } 88 }
91 break; 89 break;
92 } 90 }
93 } 91 }
94 } 92 }
95 93
96 scoped_ptr<InputMethodDescriptors> 94 scoped_ptr<InputMethodDescriptors>
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after
574 ite != extra_input_method_instances_.end(); 572 ite != extra_input_method_instances_.end();
575 ite++) { 573 ite++) {
576 if (!Contains(filtered_extension_imes_, ite->first)) 574 if (!Contains(filtered_extension_imes_, ite->first))
577 ite->second->OnDisconnected(); 575 ite->second->OnDisconnected();
578 } 576 }
579 } 577 }
580 578
581 void InputMethodManagerImpl::Init() { 579 void InputMethodManagerImpl::Init() {
582 DCHECK(!ibus_controller_.get()); 580 DCHECK(!ibus_controller_.get());
583 581
584 browser_state_monitor_.reset(new BrowserStateMonitor(this, delegate_.get()));
585 ibus_controller_.reset(IBusController::Create()); 582 ibus_controller_.reset(IBusController::Create());
586 xkeyboard_.reset(XKeyboard::Create(util_)); 583 xkeyboard_.reset(XKeyboard::Create(util_));
587 ibus_controller_->AddObserver(this); 584 ibus_controller_->AddObserver(this);
588 } 585 }
589 586
590 void InputMethodManagerImpl::SetIBusControllerForTesting( 587 void InputMethodManagerImpl::SetIBusControllerForTesting(
591 IBusController* ibus_controller) { 588 IBusController* ibus_controller) {
592 ibus_controller_.reset(ibus_controller); 589 ibus_controller_.reset(ibus_controller);
593 ibus_controller_->AddObserver(this); 590 ibus_controller_->AddObserver(this);
594 } 591 }
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
679 candidate_window_controller_.reset( 676 candidate_window_controller_.reset(
680 CandidateWindowController::CreateCandidateWindowController()); 677 CandidateWindowController::CreateCandidateWindowController());
681 if (candidate_window_controller_->Init(ibus_controller_.get())) 678 if (candidate_window_controller_->Init(ibus_controller_.get()))
682 candidate_window_controller_->AddObserver(this); 679 candidate_window_controller_->AddObserver(this);
683 else 680 else
684 DVLOG(1) << "Failed to initialize the candidate window controller"; 681 DVLOG(1) << "Failed to initialize the candidate window controller";
685 } 682 }
686 683
687 } // namespace input_method 684 } // namespace input_method
688 } // namespace chromeos 685 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698