OLD | NEW |
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/api/notifications/notifications_api.h" | 5 #include "chrome/browser/extensions/api/notifications/notifications_api.h" |
6 | 6 |
7 #include "base/callback.h" | 7 #include "base/callback.h" |
8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 // |c_rgba_data| is RGBA, pixels is ARGB. | 95 // |c_rgba_data| is RGBA, pixels is ARGB. |
96 size_t rgba_index = t * BYTES_PER_PIXEL; | 96 size_t rgba_index = t * BYTES_PER_PIXEL; |
97 pixels[t] = SkPreMultiplyColor( | 97 pixels[t] = SkPreMultiplyColor( |
98 ((c_rgba_data[rgba_index + 3] & 0xFF) << 24) | | 98 ((c_rgba_data[rgba_index + 3] & 0xFF) << 24) | |
99 ((c_rgba_data[rgba_index + 0] & 0xFF) << 16) | | 99 ((c_rgba_data[rgba_index + 0] & 0xFF) << 16) | |
100 ((c_rgba_data[rgba_index + 1] & 0xFF) << 8) | | 100 ((c_rgba_data[rgba_index + 1] & 0xFF) << 8) | |
101 ((c_rgba_data[rgba_index + 2] & 0xFF) << 0)); | 101 ((c_rgba_data[rgba_index + 2] & 0xFF) << 0)); |
102 } | 102 } |
103 | 103 |
104 // TODO(dewittj): Handle HiDPI images. | 104 // TODO(dewittj): Handle HiDPI images. |
105 ui::ScaleFactor scale_factor(ui::SCALE_FACTOR_100P); | 105 gfx::ImageSkia skia(gfx::ImageSkiaRep(bitmap, 1.0f)); |
106 gfx::ImageSkia skia(gfx::ImageSkiaRep(bitmap, scale_factor)); | |
107 *return_image = gfx::Image(skia); | 106 *return_image = gfx::Image(skia); |
108 return true; | 107 return true; |
109 } | 108 } |
110 | 109 |
111 // Given an extension id and another id, returns an id that is unique | 110 // Given an extension id and another id, returns an id that is unique |
112 // relative to other extensions. | 111 // relative to other extensions. |
113 std::string CreateScopedIdentifier(const std::string& extension_id, | 112 std::string CreateScopedIdentifier(const std::string& extension_id, |
114 const std::string& id) { | 113 const std::string& id) { |
115 return extension_id + "-" + id; | 114 return extension_id + "-" + id; |
116 } | 115 } |
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
589 StripScopeFromIdentifier(extension_->id(), *iter), true); | 588 StripScopeFromIdentifier(extension_->id(), *iter), true); |
590 } | 589 } |
591 | 590 |
592 SetResult(result.release()); | 591 SetResult(result.release()); |
593 SendResponse(true); | 592 SendResponse(true); |
594 | 593 |
595 return true; | 594 return true; |
596 } | 595 } |
597 | 596 |
598 } // namespace extensions | 597 } // namespace extensions |
OLD | NEW |