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

Side by Side Diff: chrome/browser/extensions/webstore_install_helper.cc

Issue 1112573002: [chrome/browser/extensions] Replace MessageLoopProxy usage with ThreadTaskRunnerHandle (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Resolving ng browser unittest issues Created 5 years, 7 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
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/extensions/webstore_install_helper.h" 5 #include "chrome/browser/extensions/webstore_install_helper.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/thread_task_runner_handle.h"
10 #include "base/values.h" 11 #include "base/values.h"
11 #include "chrome/browser/bitmap_fetcher/bitmap_fetcher.h" 12 #include "chrome/browser/bitmap_fetcher/bitmap_fetcher.h"
12 #include "chrome/common/chrome_utility_messages.h" 13 #include "chrome/common/chrome_utility_messages.h"
13 #include "chrome/common/extensions/chrome_utility_extensions_messages.h" 14 #include "chrome/common/extensions/chrome_utility_extensions_messages.h"
14 #include "chrome/grit/generated_resources.h" 15 #include "chrome/grit/generated_resources.h"
15 #include "content/public/browser/browser_thread.h" 16 #include "content/public/browser/browser_thread.h"
16 #include "content/public/browser/utility_process_host.h" 17 #include "content/public/browser/utility_process_host.h"
17 #include "net/base/load_flags.h" 18 #include "net/base/load_flags.h"
18 #include "net/url_request/url_request.h" 19 #include "net/url_request/url_request.h"
19 #include "ui/base/l10n/l10n_util.h" 20 #include "ui/base/l10n/l10n_util.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 66
66 BrowserThread::PostTask( 67 BrowserThread::PostTask(
67 BrowserThread::IO, 68 BrowserThread::IO,
68 FROM_HERE, 69 FROM_HERE,
69 base::Bind(&WebstoreInstallHelper::StartWorkOnIOThread, this)); 70 base::Bind(&WebstoreInstallHelper::StartWorkOnIOThread, this));
70 } 71 }
71 72
72 void WebstoreInstallHelper::StartWorkOnIOThread() { 73 void WebstoreInstallHelper::StartWorkOnIOThread() {
73 CHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 74 CHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
74 utility_host_ = UtilityProcessHost::Create( 75 utility_host_ = UtilityProcessHost::Create(
75 this, base::MessageLoopProxy::current().get())->AsWeakPtr(); 76 this, base::ThreadTaskRunnerHandle::Get().get())->AsWeakPtr();
76 utility_host_->SetName(l10n_util::GetStringUTF16( 77 utility_host_->SetName(l10n_util::GetStringUTF16(
77 IDS_UTILITY_PROCESS_JSON_PARSER_NAME)); 78 IDS_UTILITY_PROCESS_JSON_PARSER_NAME));
78 utility_host_->StartBatchMode(); 79 utility_host_->StartBatchMode();
79 80
80 utility_host_->Send(new ChromeUtilityMsg_ParseJSON(manifest_)); 81 utility_host_->Send(new ChromeUtilityMsg_ParseJSON(manifest_));
81 } 82 }
82 83
83 bool WebstoreInstallHelper::OnMessageReceived(const IPC::Message& message) { 84 bool WebstoreInstallHelper::OnMessageReceived(const IPC::Message& message) {
84 bool handled = true; 85 bool handled = true;
85 IPC_BEGIN_MESSAGE_MAP(WebstoreInstallHelper, message) 86 IPC_BEGIN_MESSAGE_MAP(WebstoreInstallHelper, message)
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 159
159 void WebstoreInstallHelper::ReportResultFromUIThread() { 160 void WebstoreInstallHelper::ReportResultFromUIThread() {
160 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 161 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
161 if (error_.empty() && parsed_manifest_) 162 if (error_.empty() && parsed_manifest_)
162 delegate_->OnWebstoreParseSuccess(id_, icon_, parsed_manifest_.release()); 163 delegate_->OnWebstoreParseSuccess(id_, icon_, parsed_manifest_.release());
163 else 164 else
164 delegate_->OnWebstoreParseFailure(id_, parse_error_, error_); 165 delegate_->OnWebstoreParseFailure(id_, parse_error_, error_);
165 } 166 }
166 167
167 } // namespace extensions 168 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/updater/extension_updater_unittest.cc ('k') | chrome/browser/extensions/zipfile_installer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698