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

Side by Side Diff: win8/metro_driver/ime/input_source.cc

Issue 625073003: Replacing the OVERRIDE with override and FINAL with final in win8 folder (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Corrected patchset-1 Created 6 years, 2 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
« no previous file with comments | « win8/metro_driver/ime/input_scope.cc ('k') | win8/metro_driver/ime/text_service.cc » ('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 "win8/metro_driver/ime/input_source.h" 5 #include "win8/metro_driver/ime/input_source.h"
6 6
7 #include <atlbase.h> 7 #include <atlbase.h>
8 #include <atlcom.h> 8 #include <atlcom.h>
9 #include <msctf.h> 9 #include <msctf.h>
10 10
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 if (cookie_ == TF_INVALID_COOKIE || !source_) 56 if (cookie_ == TF_INVALID_COOKIE || !source_)
57 return; 57 return;
58 if (FAILED(source_->UnadviseSink(cookie_))) 58 if (FAILED(source_->UnadviseSink(cookie_)))
59 return; 59 return;
60 cookie_ = TF_INVALID_COOKIE; 60 cookie_ = TF_INVALID_COOKIE;
61 source_.Release(); 61 source_.Release();
62 } 62 }
63 63
64 private: 64 private:
65 // ITfLanguageProfileNotifySink overrides: 65 // ITfLanguageProfileNotifySink overrides:
66 STDMETHOD(OnLanguageChange)(LANGID langid, BOOL *accept) OVERRIDE { 66 STDMETHOD(OnLanguageChange)(LANGID langid, BOOL *accept) override {
67 if (!accept) 67 if (!accept)
68 return E_INVALIDARG; 68 return E_INVALIDARG;
69 *accept = TRUE; 69 *accept = TRUE;
70 return S_OK; 70 return S_OK;
71 } 71 }
72 72
73 STDMETHOD(OnLanguageChanged)() OVERRIDE { 73 STDMETHOD(OnLanguageChanged)() override {
74 if (!on_language_chanaged_.is_null()) 74 if (!on_language_chanaged_.is_null())
75 on_language_chanaged_.Run(); 75 on_language_chanaged_.Run();
76 return S_OK; 76 return S_OK;
77 } 77 }
78 78
79 base::Closure on_language_chanaged_; 79 base::Closure on_language_chanaged_;
80 base::win::ScopedComPtr<ITfSource> source_; 80 base::win::ScopedComPtr<ITfSource> source_;
81 DWORD cookie_; 81 DWORD cookie_;
82 82
83 DISALLOW_COPY_AND_ASSIGN(InputSourceMonitor); 83 DISALLOW_COPY_AND_ASSIGN(InputSourceMonitor);
84 }; 84 };
85 85
86 class InputSourceImpl : public InputSource { 86 class InputSourceImpl : public InputSource {
87 public: 87 public:
88 InputSourceImpl(ITfInputProcessorProfileMgr* profile_manager, 88 InputSourceImpl(ITfInputProcessorProfileMgr* profile_manager,
89 InputSourceMonitor* monitor) 89 InputSourceMonitor* monitor)
90 : profile_manager_(profile_manager), 90 : profile_manager_(profile_manager),
91 monitor_(monitor) { 91 monitor_(monitor) {
92 monitor_->SetCallback(base::Bind(&InputSourceImpl::OnLanguageChanged, 92 monitor_->SetCallback(base::Bind(&InputSourceImpl::OnLanguageChanged,
93 base::Unretained(this))); 93 base::Unretained(this)));
94 } 94 }
95 virtual ~InputSourceImpl() { 95 virtual ~InputSourceImpl() {
96 monitor_->SetCallback(base::Closure()); 96 monitor_->SetCallback(base::Closure());
97 monitor_->Unadvise(); 97 monitor_->Unadvise();
98 } 98 }
99 99
100 private: 100 private:
101 // InputSource overrides. 101 // InputSource overrides.
102 virtual bool GetActiveSource(LANGID* langid, bool* is_ime) OVERRIDE { 102 virtual bool GetActiveSource(LANGID* langid, bool* is_ime) override {
103 TF_INPUTPROCESSORPROFILE profile = {}; 103 TF_INPUTPROCESSORPROFILE profile = {};
104 HRESULT hr = profile_manager_->GetActiveProfile(GUID_TFCAT_TIP_KEYBOARD, 104 HRESULT hr = profile_manager_->GetActiveProfile(GUID_TFCAT_TIP_KEYBOARD,
105 &profile); 105 &profile);
106 if (FAILED(hr)) { 106 if (FAILED(hr)) {
107 LOG(ERROR) << "ITfInputProcessorProfileMgr::GetActiveProfile failed." 107 LOG(ERROR) << "ITfInputProcessorProfileMgr::GetActiveProfile failed."
108 << " hr = " << hr; 108 << " hr = " << hr;
109 return false; 109 return false;
110 } 110 }
111 *langid = profile.langid; 111 *langid = profile.langid;
112 *is_ime = profile.dwProfileType == TF_PROFILETYPE_INPUTPROCESSOR; 112 *is_ime = profile.dwProfileType == TF_PROFILETYPE_INPUTPROCESSOR;
113 return true; 113 return true;
114 } 114 }
115 virtual void AddObserver(InputSourceObserver* observer) OVERRIDE { 115 virtual void AddObserver(InputSourceObserver* observer) override {
116 observer_list_.AddObserver(observer); 116 observer_list_.AddObserver(observer);
117 } 117 }
118 virtual void RemoveObserver(InputSourceObserver* observer) OVERRIDE { 118 virtual void RemoveObserver(InputSourceObserver* observer) override {
119 observer_list_.RemoveObserver(observer); 119 observer_list_.RemoveObserver(observer);
120 } 120 }
121 void OnLanguageChanged() { 121 void OnLanguageChanged() {
122 FOR_EACH_OBSERVER(InputSourceObserver, 122 FOR_EACH_OBSERVER(InputSourceObserver,
123 observer_list_, 123 observer_list_,
124 OnInputSourceChanged()); 124 OnInputSourceChanged());
125 } 125 }
126 126
127 base::win::ScopedComPtr<ITfInputProcessorProfileMgr> profile_manager_; 127 base::win::ScopedComPtr<ITfInputProcessorProfileMgr> profile_manager_;
128 scoped_refptr<InputSourceMonitor> monitor_; 128 scoped_refptr<InputSourceMonitor> monitor_;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 if (!monitor->Initialize(profiles_source)) { 161 if (!monitor->Initialize(profiles_source)) {
162 LOG(ERROR) << "Failed to initialize the monitor."; 162 LOG(ERROR) << "Failed to initialize the monitor.";
163 return scoped_ptr<InputSource>(); 163 return scoped_ptr<InputSource>();
164 } 164 }
165 165
166 // Transfer the ownership. 166 // Transfer the ownership.
167 return scoped_ptr<InputSource>(new InputSourceImpl(profile_manager, monitor)); 167 return scoped_ptr<InputSource>(new InputSourceImpl(profile_manager, monitor));
168 } 168 }
169 169
170 } // namespace metro_driver 170 } // namespace metro_driver
OLDNEW
« no previous file with comments | « win8/metro_driver/ime/input_scope.cc ('k') | win8/metro_driver/ime/text_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698