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

Side by Side Diff: chrome/browser/chromeos/app_mode/kiosk_app_data.cc

Issue 1036723003: favor DCHECK_CURRENTLY_ON for better logs in chrome/browser/chromeos/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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 | chrome/browser/chromeos/app_mode/kiosk_profile_loader.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 "chrome/browser/chromeos/app_mode/kiosk_app_data.h" 5 #include "chrome/browser/chromeos/app_mode/kiosk_app_data.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/files/file_util.h" 10 #include "base/files/file_util.h"
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 LOG(WARNING) << "Can not delete temp directory at " 160 LOG(WARNING) << "Can not delete temp directory at "
161 << temp_dir_.path().value(); 161 << temp_dir_.path().value();
162 } 162 }
163 163
164 BrowserThread::PostTask( 164 BrowserThread::PostTask(
165 BrowserThread::UI, FROM_HERE, 165 BrowserThread::UI, FROM_HERE,
166 base::Bind(&CrxLoader::NotifyFinishedOnUIThread, this)); 166 base::Bind(&CrxLoader::NotifyFinishedOnUIThread, this));
167 } 167 }
168 168
169 void NotifyFinishedOnUIThread() { 169 void NotifyFinishedOnUIThread() {
170 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 170 DCHECK_CURRENTLY_ON(BrowserThread::UI);
171 171
172 if (client_) 172 if (client_)
173 client_->OnCrxLoadFinished(this); 173 client_->OnCrxLoadFinished(this);
174 } 174 }
175 175
176 base::WeakPtr<KioskAppData> client_; 176 base::WeakPtr<KioskAppData> client_;
177 base::FilePath crx_file_; 177 base::FilePath crx_file_;
178 bool success_; 178 bool success_;
179 179
180 scoped_refptr<base::SequencedTaskRunner> task_runner_; 180 scoped_refptr<base::SequencedTaskRunner> task_runner_;
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 if (!client_) 252 if (!client_)
253 return; 253 return;
254 254
255 if (load_result_ == SUCCESS) 255 if (load_result_ == SUCCESS)
256 client_->OnIconLoadSuccess(icon_); 256 client_->OnIconLoadSuccess(icon_);
257 else 257 else
258 client_->OnIconLoadFailure(); 258 client_->OnIconLoadFailure();
259 } 259 }
260 260
261 void ReportResultOnUIThread() { 261 void ReportResultOnUIThread() {
262 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 262 DCHECK_CURRENTLY_ON(BrowserThread::UI);
263 263
264 NotifyClient(); 264 NotifyClient();
265 delete this; 265 delete this;
266 } 266 }
267 267
268 // ImageDecoder::Delegate overrides: 268 // ImageDecoder::Delegate overrides:
269 void OnImageDecoded(const ImageDecoder* decoder, 269 void OnImageDecoded(const ImageDecoder* decoder,
270 const SkBitmap& decoded_image) override { 270 const SkBitmap& decoded_image) override {
271 icon_ = gfx::ImageSkia::CreateFrom1xBitmap(decoded_image); 271 icon_ = gfx::ImageSkia::CreateFrom1xBitmap(decoded_image);
272 icon_.MakeThreadSafe(); 272 icon_.MakeThreadSafe();
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
526 << ", id=" << app_id_; 526 << ", id=" << app_id_;
527 SetCache(name_, *extensions::util::GetDefaultAppIcon().bitmap()); 527 SetCache(name_, *extensions::util::GetDefaultAppIcon().bitmap());
528 } else { 528 } else {
529 SetCache(name_, icon.AsBitmap()); 529 SetCache(name_, icon.AsBitmap());
530 } 530 }
531 531
532 SetStatus(STATUS_LOADED); 532 SetStatus(STATUS_LOADED);
533 } 533 }
534 534
535 void KioskAppData::OnIconLoadSuccess(const gfx::ImageSkia& icon) { 535 void KioskAppData::OnIconLoadSuccess(const gfx::ImageSkia& icon) {
536 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 536 DCHECK_CURRENTLY_ON(BrowserThread::UI);
537 icon_ = icon; 537 icon_ = icon;
538 SetStatus(STATUS_LOADED); 538 SetStatus(STATUS_LOADED);
539 } 539 }
540 540
541 void KioskAppData::OnIconLoadFailure() { 541 void KioskAppData::OnIconLoadFailure() {
542 // Re-fetch data from web store when failed to load cached data. 542 // Re-fetch data from web store when failed to load cached data.
543 StartFetch(); 543 StartFetch();
544 } 544 }
545 545
546 void KioskAppData::OnWebstoreParseSuccess(const SkBitmap& icon) { 546 void KioskAppData::OnWebstoreParseSuccess(const SkBitmap& icon) {
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
644 644
645 SkBitmap icon = crx_loader->icon(); 645 SkBitmap icon = crx_loader->icon();
646 if (icon.empty()) 646 if (icon.empty())
647 icon = *extensions::util::GetDefaultAppIcon().bitmap(); 647 icon = *extensions::util::GetDefaultAppIcon().bitmap();
648 SetCache(crx_loader->name(), icon); 648 SetCache(crx_loader->name(), icon);
649 649
650 SetStatus(STATUS_LOADED); 650 SetStatus(STATUS_LOADED);
651 } 651 }
652 652
653 } // namespace chromeos 653 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/app_mode/kiosk_profile_loader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698