| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 // This file is for non-chromeos (win & linux) functions, such as | 5 // This file is for non-chromeos (win & linux) functions, such as |
| 6 // chrome.input.ime.activate, chrome.input.ime.createWindow and | 6 // chrome.input.ime.activate, chrome.input.ime.createWindow and |
| 7 // chrome.input.ime.onSelectionChanged. | 7 // chrome.input.ime.onSelectionChanged. |
| 8 // TODO(azurewei): May refactor the code structure by using delegate or | 8 // TODO(azurewei): May refactor the code structure by using delegate or |
| 9 // redesign the API to remove this platform-specific file in the future. | 9 // redesign the API to remove this platform-specific file in the future. |
| 10 | 10 |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 private: | 107 private: |
| 108 // ImeObserver overrides. | 108 // ImeObserver overrides. |
| 109 void DispatchEventToExtension( | 109 void DispatchEventToExtension( |
| 110 extensions::events::HistogramValue histogram_value, | 110 extensions::events::HistogramValue histogram_value, |
| 111 const std::string& event_name, | 111 const std::string& event_name, |
| 112 std::unique_ptr<base::ListValue> args) override { | 112 std::unique_ptr<base::ListValue> args) override { |
| 113 if (!IsInputImeEnabled()) { | 113 if (!IsInputImeEnabled()) { |
| 114 return; | 114 return; |
| 115 } | 115 } |
| 116 | 116 |
| 117 std::unique_ptr<extensions::Event> event( | 117 auto event = base::MakeUnique<extensions::Event>( |
| 118 new extensions::Event(histogram_value, event_name, std::move(args))); | 118 histogram_value, event_name, std::move(args), profile_); |
| 119 event->restrict_to_browser_context = profile_; | |
| 120 extensions::EventRouter::Get(profile_) | 119 extensions::EventRouter::Get(profile_) |
| 121 ->DispatchEventToExtension(extension_id_, std::move(event)); | 120 ->DispatchEventToExtension(extension_id_, std::move(event)); |
| 122 } | 121 } |
| 123 | 122 |
| 124 std::string GetCurrentScreenType() override { return "normal"; } | 123 std::string GetCurrentScreenType() override { return "normal"; } |
| 125 | 124 |
| 126 DISALLOW_COPY_AND_ASSIGN(ImeObserverNonChromeOS); | 125 DISALLOW_COPY_AND_ASSIGN(ImeObserverNonChromeOS); |
| 127 }; | 126 }; |
| 128 | 127 |
| 129 } // namespace | 128 } // namespace |
| (...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 411 return RespondNow(Error(kErrorNoActiveEngine)); | 410 return RespondNow(Error(kErrorNoActiveEngine)); |
| 412 | 411 |
| 413 std::unique_ptr<api::input_ime::HideWindow::Params> params( | 412 std::unique_ptr<api::input_ime::HideWindow::Params> params( |
| 414 api::input_ime::HideWindow::Params::Create(*args_)); | 413 api::input_ime::HideWindow::Params::Create(*args_)); |
| 415 EXTENSION_FUNCTION_VALIDATE(params.get()); | 414 EXTENSION_FUNCTION_VALIDATE(params.get()); |
| 416 engine->HideImeWindow(params->window_id); | 415 engine->HideImeWindow(params->window_id); |
| 417 return RespondNow(NoArguments()); | 416 return RespondNow(NoArguments()); |
| 418 } | 417 } |
| 419 | 418 |
| 420 } // namespace extensions | 419 } // namespace extensions |
| OLD | NEW |