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

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

Issue 2952663003: Migrate a BrowserThread::PostTask to TaskScheduler (Closed)
Patch Set: Created 3 years, 6 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 | « no previous file | no next file » | 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/chromeos/input_method/component_extension_ime_manager_i mpl.h" 5 #include "chrome/browser/chromeos/input_method/component_extension_ime_manager_i mpl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
11 #include "base/files/file_util.h" 11 #include "base/files/file_util.h"
12 #include "base/json/json_string_value_serializer.h" 12 #include "base/json/json_string_value_serializer.h"
13 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "base/macros.h" 14 #include "base/macros.h"
15 #include "base/path_service.h" 15 #include "base/path_service.h"
16 #include "base/strings/string_util.h" 16 #include "base/strings/string_util.h"
17 #include "base/sys_info.h" 17 #include "base/sys_info.h"
18 #include "base/task_scheduler/post_task.h"
18 #include "chrome/browser/extensions/component_loader.h" 19 #include "chrome/browser/extensions/component_loader.h"
19 #include "chrome/browser/extensions/extension_service.h" 20 #include "chrome/browser/extensions/extension_service.h"
20 #include "chrome/browser/profiles/profile.h" 21 #include "chrome/browser/profiles/profile.h"
21 #include "chrome/browser/profiles/profile_manager.h" 22 #include "chrome/browser/profiles/profile_manager.h"
22 #include "chrome/common/chrome_paths.h" 23 #include "chrome/common/chrome_paths.h"
23 #include "chrome/common/extensions/extension_constants.h" 24 #include "chrome/common/extensions/extension_constants.h"
24 #include "chrome/grit/browser_resources.h" 25 #include "chrome/grit/browser_resources.h"
25 #include "content/public/browser/browser_thread.h"
26 #include "extensions/browser/extension_pref_value_map.h" 26 #include "extensions/browser/extension_pref_value_map.h"
27 #include "extensions/browser/extension_pref_value_map_factory.h" 27 #include "extensions/browser/extension_pref_value_map_factory.h"
28 #include "extensions/browser/extension_system.h" 28 #include "extensions/browser/extension_system.h"
29 #include "extensions/common/extension.h" 29 #include "extensions/common/extension.h"
30 #include "extensions/common/manifest_constants.h" 30 #include "extensions/common/manifest_constants.h"
31 #include "ui/base/ime/chromeos/extension_ime_util.h" 31 #include "ui/base/ime/chromeos/extension_ime_util.h"
32 #include "ui/base/resource/resource_bundle.h" 32 #include "ui/base/resource/resource_bundle.h"
33 33
34 namespace chromeos { 34 namespace chromeos {
35 35
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 } 141 }
142 142
143 void ComponentExtensionIMEManagerImpl::Load(Profile* profile, 143 void ComponentExtensionIMEManagerImpl::Load(Profile* profile,
144 const std::string& extension_id, 144 const std::string& extension_id,
145 const std::string& manifest, 145 const std::string& manifest,
146 const base::FilePath& file_path) { 146 const base::FilePath& file_path) {
147 // Check the existence of file path to avoid unnecessary extension loading 147 // Check the existence of file path to avoid unnecessary extension loading
148 // and InputMethodEngine creation, so that the virtual keyboard web content 148 // and InputMethodEngine creation, so that the virtual keyboard web content
149 // url won't be override by IME component extensions. 149 // url won't be override by IME component extensions.
150 base::FilePath* copied_file_path = new base::FilePath(file_path); 150 base::FilePath* copied_file_path = new base::FilePath(file_path);
151 content::BrowserThread::PostTaskAndReplyWithResult( 151 base::PostTaskWithTraitsAndReplyWithResult(
152 content::BrowserThread::FILE, 152 FROM_HERE, {base::MayBlock(), base::TaskPriority::BACKGROUND},
153 FROM_HERE, 153 base::Bind(&CheckFilePath, base::Unretained(copied_file_path)),
154 base::Bind(&CheckFilePath, 154 base::Bind(&OnFilePathChecked, base::Unretained(profile),
155 base::Unretained(copied_file_path)),
156 base::Bind(&OnFilePathChecked,
157 base::Unretained(profile),
158 base::Owned(new std::string(extension_id)), 155 base::Owned(new std::string(extension_id)),
159 base::Owned(new std::string(manifest)), 156 base::Owned(new std::string(manifest)),
160 base::Owned(copied_file_path))); 157 base::Owned(copied_file_path)));
161 } 158 }
162 159
163 void ComponentExtensionIMEManagerImpl::Unload(Profile* profile, 160 void ComponentExtensionIMEManagerImpl::Unload(Profile* profile,
164 const std::string& extension_id, 161 const std::string& extension_id,
165 const base::FilePath& file_path) { 162 const base::FilePath& file_path) {
166 // Remove(extension_id) does nothing when the extension has already been 163 // Remove(extension_id) does nothing when the extension has already been
167 // removed or not been registered. 164 // removed or not been registered.
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 334
338 ComponentExtensionEngine engine; 335 ComponentExtensionEngine engine;
339 ReadEngineComponent(component_ime, *dictionary, &engine); 336 ReadEngineComponent(component_ime, *dictionary, &engine);
340 component_ime.engines.push_back(engine); 337 component_ime.engines.push_back(engine);
341 } 338 }
342 out_imes->push_back(component_ime); 339 out_imes->push_back(component_ime);
343 } 340 }
344 } 341 }
345 342
346 } // namespace chromeos 343 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698