OLD | NEW |
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 "ui/android/resources/ui_resource_android.h" | 5 #include "ui/android/resources/ui_resource_android.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "content/public/browser/android/ui_resource_provider.h" | 8 #include "ui/android/resources/ui_resource_provider.h" |
9 | 9 |
10 namespace ui { | 10 namespace ui { |
11 | 11 |
12 scoped_ptr<UIResourceAndroid> UIResourceAndroid::CreateFromJavaBitmap( | 12 scoped_ptr<UIResourceAndroid> UIResourceAndroid::CreateFromJavaBitmap( |
13 content::UIResourceProvider* provider, | 13 ui::UIResourceProvider* provider, |
14 const gfx::JavaBitmap& java_bitmap) { | 14 const gfx::JavaBitmap& java_bitmap) { |
15 SkBitmap skbitmap = gfx::CreateSkBitmapFromJavaBitmap(java_bitmap); | 15 SkBitmap skbitmap = gfx::CreateSkBitmapFromJavaBitmap(java_bitmap); |
16 skbitmap.setImmutable(); | 16 skbitmap.setImmutable(); |
17 | 17 |
18 return make_scoped_ptr(new UIResourceAndroid(provider, skbitmap)); | 18 return make_scoped_ptr(new UIResourceAndroid(provider, skbitmap)); |
19 } | 19 } |
20 | 20 |
21 UIResourceAndroid::~UIResourceAndroid() { | 21 UIResourceAndroid::~UIResourceAndroid() { |
22 if (id_ && provider_) | 22 if (id_ && provider_) |
23 provider_->DeleteUIResource(id_); | 23 provider_->DeleteUIResource(id_); |
(...skipping 11 matching lines...) Expand all Loading... |
35 if (!provider_ || bitmap_.empty()) | 35 if (!provider_ || bitmap_.empty()) |
36 return 0; | 36 return 0; |
37 id_ = provider_->CreateUIResource(this); | 37 id_ = provider_->CreateUIResource(this); |
38 return id_; | 38 return id_; |
39 } | 39 } |
40 | 40 |
41 void UIResourceAndroid::UIResourceIsInvalid() { | 41 void UIResourceAndroid::UIResourceIsInvalid() { |
42 id_ = 0; | 42 id_ = 0; |
43 } | 43 } |
44 | 44 |
45 UIResourceAndroid::UIResourceAndroid(content::UIResourceProvider* provider, | 45 UIResourceAndroid::UIResourceAndroid(ui::UIResourceProvider* provider, |
46 const SkBitmap& skbitmap) | 46 const SkBitmap& skbitmap) |
47 : provider_(provider), bitmap_(skbitmap), id_(0) { | 47 : provider_(provider), bitmap_(skbitmap), id_(0) { |
48 } | 48 } |
49 | 49 |
50 } // namespace ui | 50 } // namespace ui |
OLD | NEW |