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

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

Issue 2825963003: Rewrite base::Bind to base::BindOnce with base_bind_rewriters in //chrome/browser/extensions (Closed)
Patch Set: Created 3 years, 8 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/startup_helper.h" 5 #include "chrome/browser/extensions/startup_helper.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 temp_dir_(temp_dir), 83 temp_dir_(temp_dir),
84 run_loop_(run_loop), 84 run_loop_(run_loop),
85 finished_(false), 85 finished_(false),
86 success_(false) {} 86 success_(false) {}
87 87
88 bool finished() { return finished_; } 88 bool finished() { return finished_; }
89 bool success() { return success_; } 89 bool success() { return success_; }
90 const base::string16& error() { return error_; } 90 const base::string16& error() { return error_; }
91 91
92 void Start() { 92 void Start() {
93 BrowserThread::PostTask(BrowserThread::FILE, 93 BrowserThread::PostTask(
94 FROM_HERE, 94 BrowserThread::FILE, FROM_HERE,
95 base::Bind(&ValidateCrxHelper::StartOnFileThread, 95 base::BindOnce(&ValidateCrxHelper::StartOnFileThread, this));
96 this));
97 } 96 }
98 97
99 protected: 98 protected:
100 ~ValidateCrxHelper() override {} 99 ~ValidateCrxHelper() override {}
101 100
102 void OnUnpackSuccess(const base::FilePath& temp_dir, 101 void OnUnpackSuccess(const base::FilePath& temp_dir,
103 const base::FilePath& extension_root, 102 const base::FilePath& extension_root,
104 std::unique_ptr<base::DictionaryValue> original_manifest, 103 std::unique_ptr<base::DictionaryValue> original_manifest,
105 const Extension* extension, 104 const Extension* extension,
106 const SkBitmap& install_icon) override { 105 const SkBitmap& install_icon) override {
107 finished_ = true; 106 finished_ = true;
108 success_ = true; 107 success_ = true;
109 BrowserThread::PostTask(BrowserThread::UI, 108 BrowserThread::PostTask(
110 FROM_HERE, 109 BrowserThread::UI, FROM_HERE,
111 base::Bind(&ValidateCrxHelper::FinishOnUIThread, 110 base::BindOnce(&ValidateCrxHelper::FinishOnUIThread, this));
112 this));
113 } 111 }
114 112
115 void OnUnpackFailure(const CrxInstallError& error) override { 113 void OnUnpackFailure(const CrxInstallError& error) override {
116 finished_ = true; 114 finished_ = true;
117 success_ = false; 115 success_ = false;
118 error_ = error.message(); 116 error_ = error.message();
119 BrowserThread::PostTask(BrowserThread::UI, 117 BrowserThread::PostTask(
120 FROM_HERE, 118 BrowserThread::UI, FROM_HERE,
121 base::Bind(&ValidateCrxHelper::FinishOnUIThread, 119 base::BindOnce(&ValidateCrxHelper::FinishOnUIThread, this));
122 this));
123 } 120 }
124 121
125 void FinishOnUIThread() { 122 void FinishOnUIThread() {
126 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 123 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
127 if (run_loop_->running()) 124 if (run_loop_->running())
128 run_loop_->Quit(); 125 run_loop_->Quit();
129 } 126 }
130 127
131 void StartOnFileThread() { 128 void StartOnFileThread() {
132 CHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); 129 CHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 *error = base::UTF16ToUTF8(helper->error()); 185 *error = base::UTF16ToUTF8(helper->error());
189 return success; 186 return success;
190 } 187 }
191 188
192 StartupHelper::~StartupHelper() { 189 StartupHelper::~StartupHelper() {
193 if (pack_job_.get()) 190 if (pack_job_.get())
194 pack_job_->ClearClient(); 191 pack_job_->ClearClient();
195 } 192 }
196 193
197 } // namespace extensions 194 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/signin/gaia_auth_extension_loader.cc ('k') | chrome/browser/extensions/test_blacklist.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698