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

Side by Side Diff: chrome/browser/android/thumbnail/thumbnail.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 "base/logging.h" 5 #include "base/logging.h"
6 #include "chrome/browser/android/thumbnail/thumbnail.h" 6 #include "chrome/browser/android/thumbnail/thumbnail.h"
7 #include "content/public/browser/android/ui_resource_provider.h"
8 #include "third_party/skia/include/core/SkBitmap.h" 7 #include "third_party/skia/include/core/SkBitmap.h"
9 #include "third_party/skia/include/core/SkCanvas.h" 8 #include "third_party/skia/include/core/SkCanvas.h"
9 #include "ui/android/resources/ui_resource_provider.h"
10 #include "ui/gfx/geometry/size_conversions.h" 10 #include "ui/gfx/geometry/size_conversions.h"
11 11
12 namespace { 12 namespace {
13 13
14 SkBitmap CreateSmallHolderBitmap() { 14 SkBitmap CreateSmallHolderBitmap() {
15 SkBitmap small_bitmap; 15 SkBitmap small_bitmap;
16 SkCanvas canvas(small_bitmap); 16 SkCanvas canvas(small_bitmap);
17 small_bitmap.allocPixels( 17 small_bitmap.allocPixels(
18 SkImageInfo::Make(1, 1, kRGBA_8888_SkColorType, kOpaque_SkAlphaType)); 18 SkImageInfo::Make(1, 1, kRGBA_8888_SkColorType, kOpaque_SkAlphaType));
19 canvas.drawColor(SK_ColorWHITE); 19 canvas.drawColor(SK_ColorWHITE);
20 small_bitmap.setImmutable(); 20 small_bitmap.setImmutable();
21 return small_bitmap; 21 return small_bitmap;
22 } 22 }
23 23
24 } // anonymous namespace 24 } // anonymous namespace
25 25
26 scoped_ptr<Thumbnail> Thumbnail::Create( 26 scoped_ptr<Thumbnail> Thumbnail::Create(
27 TabId tab_id, 27 TabId tab_id,
28 const base::Time& time_stamp, 28 const base::Time& time_stamp,
29 float scale, 29 float scale,
30 content::UIResourceProvider* ui_resource_provider, 30 ui::UIResourceProvider* ui_resource_provider,
31 ThumbnailDelegate* thumbnail_delegate) { 31 ThumbnailDelegate* thumbnail_delegate) {
32 return make_scoped_ptr(new Thumbnail( 32 return make_scoped_ptr(new Thumbnail(
33 tab_id, time_stamp, scale, ui_resource_provider, thumbnail_delegate)); 33 tab_id, time_stamp, scale, ui_resource_provider, thumbnail_delegate));
34 } 34 }
35 35
36 Thumbnail::Thumbnail(TabId tab_id, 36 Thumbnail::Thumbnail(TabId tab_id,
37 const base::Time& time_stamp, 37 const base::Time& time_stamp,
38 float scale, 38 float scale,
39 content::UIResourceProvider* ui_resource_provider, 39 ui::UIResourceProvider* ui_resource_provider,
40 ThumbnailDelegate* thumbnail_delegate) 40 ThumbnailDelegate* thumbnail_delegate)
41 : tab_id_(tab_id), 41 : tab_id_(tab_id),
42 time_stamp_(time_stamp), 42 time_stamp_(time_stamp),
43 scale_(scale), 43 scale_(scale),
44 bitmap_(gfx::Size(1, 1), true), 44 bitmap_(gfx::Size(1, 1), true),
45 ui_resource_id_(0), 45 ui_resource_id_(0),
46 retrieved_(false), 46 retrieved_(false),
47 ui_resource_provider_(ui_resource_provider), 47 ui_resource_provider_(ui_resource_provider),
48 thumbnail_delegate_(thumbnail_delegate) { 48 thumbnail_delegate_(thumbnail_delegate) {
49 } 49 }
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 ui_resource_id_ = 0; 96 ui_resource_id_ = 0;
97 if (thumbnail_delegate_) 97 if (thumbnail_delegate_)
98 thumbnail_delegate_->InvalidateCachedThumbnail(this); 98 thumbnail_delegate_->InvalidateCachedThumbnail(this);
99 } 99 }
100 100
101 void Thumbnail::ClearUIResourceId() { 101 void Thumbnail::ClearUIResourceId() {
102 if (ui_resource_id_ && ui_resource_provider_) 102 if (ui_resource_id_ && ui_resource_provider_)
103 ui_resource_provider_->DeleteUIResource(ui_resource_id_); 103 ui_resource_provider_->DeleteUIResource(ui_resource_id_);
104 ui_resource_id_ = 0; 104 ui_resource_id_ = 0;
105 } 105 }
OLDNEW
« no previous file with comments | « chrome/browser/android/thumbnail/thumbnail.h ('k') | chrome/browser/android/thumbnail/thumbnail_store.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698