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

Side by Side Diff: chrome/browser/android/thumbnail/thumbnail_store.cc

Issue 755643004: Replace SystemUIResourceManager with ResourceManager (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix clang build failure Created 6 years 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/android/thumbnail/thumbnail_store.h" 5 #include "chrome/browser/android/thumbnail/thumbnail_store.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 9
10 #include "base/big_endian.h" 10 #include "base/big_endian.h"
11 #include "base/files/file.h" 11 #include "base/files/file.h"
12 #include "base/files/file_enumerator.h" 12 #include "base/files/file_enumerator.h"
13 #include "base/files/file_path.h" 13 #include "base/files/file_path.h"
14 #include "base/files/file_util.h" 14 #include "base/files/file_util.h"
15 #include "base/strings/string_number_conversions.h" 15 #include "base/strings/string_number_conversions.h"
16 #include "base/threading/worker_pool.h" 16 #include "base/threading/worker_pool.h"
17 #include "base/time/time.h" 17 #include "base/time/time.h"
18 #include "content/public/browser/android/ui_resource_provider.h"
19 #include "content/public/browser/browser_thread.h" 18 #include "content/public/browser/browser_thread.h"
20 #include "third_party/android_opengl/etc1/etc1.h" 19 #include "third_party/android_opengl/etc1/etc1.h"
21 #include "third_party/skia/include/core/SkBitmap.h" 20 #include "third_party/skia/include/core/SkBitmap.h"
22 #include "third_party/skia/include/core/SkCanvas.h" 21 #include "third_party/skia/include/core/SkCanvas.h"
23 #include "third_party/skia/include/core/SkData.h" 22 #include "third_party/skia/include/core/SkData.h"
24 #include "third_party/skia/include/core/SkMallocPixelRef.h" 23 #include "third_party/skia/include/core/SkMallocPixelRef.h"
25 #include "third_party/skia/include/core/SkPixelRef.h" 24 #include "third_party/skia/include/core/SkPixelRef.h"
25 #include "ui/android/resources/ui_resource_provider.h"
26 #include "ui/gfx/android/device_display_info.h" 26 #include "ui/gfx/android/device_display_info.h"
27 #include "ui/gfx/geometry/size_conversions.h" 27 #include "ui/gfx/geometry/size_conversions.h"
28 28
29 namespace { 29 namespace {
30 30
31 const float kApproximationScaleFactor = 4.f; 31 const float kApproximationScaleFactor = 4.f;
32 const base::TimeDelta kCaptureMinRequestTimeMs( 32 const base::TimeDelta kCaptureMinRequestTimeMs(
33 base::TimeDelta::FromMilliseconds(1000)); 33 base::TimeDelta::FromMilliseconds(1000));
34 34
35 const int kCompressedKey = 0xABABABAB; 35 const int kCompressedKey = 0xABABABAB;
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 ui_resource_provider_(NULL), 129 ui_resource_provider_(NULL),
130 weak_factory_(this) { 130 weak_factory_(this) {
131 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); 131 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
132 } 132 }
133 133
134 ThumbnailStore::~ThumbnailStore() { 134 ThumbnailStore::~ThumbnailStore() {
135 SetUIResourceProvider(NULL); 135 SetUIResourceProvider(NULL);
136 } 136 }
137 137
138 void ThumbnailStore::SetUIResourceProvider( 138 void ThumbnailStore::SetUIResourceProvider(
139 content::UIResourceProvider* ui_resource_provider) { 139 ui::UIResourceProvider* ui_resource_provider) {
140 if (ui_resource_provider_ == ui_resource_provider) 140 if (ui_resource_provider_ == ui_resource_provider)
141 return; 141 return;
142 142
143 approximation_cache_.Clear(); 143 approximation_cache_.Clear();
144 cache_.Clear(); 144 cache_.Clear();
145 145
146 ui_resource_provider_ = ui_resource_provider; 146 ui_resource_provider_ = ui_resource_provider;
147 } 147 }
148 148
149 void ThumbnailStore::AddThumbnailStoreObserver( 149 void ThumbnailStore::AddThumbnailStoreObserver(
(...skipping 771 matching lines...) Expand 10 before | Expand all | Expand 10 after
921 dst_bitmap.eraseColor(0); 921 dst_bitmap.eraseColor(0);
922 SkAutoLockPixels dst_bitmap_lock(dst_bitmap); 922 SkAutoLockPixels dst_bitmap_lock(dst_bitmap);
923 923
924 SkCanvas canvas(dst_bitmap); 924 SkCanvas canvas(dst_bitmap);
925 canvas.scale(new_scale, new_scale); 925 canvas.scale(new_scale, new_scale);
926 canvas.drawBitmap(bitmap, 0, 0, NULL); 926 canvas.drawBitmap(bitmap, 0, 0, NULL);
927 dst_bitmap.setImmutable(); 927 dst_bitmap.setImmutable();
928 928
929 return std::make_pair(dst_bitmap, new_scale * scale); 929 return std::make_pair(dst_bitmap, new_scale * scale);
930 } 930 }
OLDNEW
« no previous file with comments | « chrome/browser/android/thumbnail/thumbnail_store.h ('k') | content/browser/android/browser_jni_registrar.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698