| 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/ui/views/create_application_shortcut_view.h" | 5 #include "chrome/browser/ui/views/create_application_shortcut_view.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <algorithm> | 8 #include <algorithm> |
| 9 #include <cmath> | 9 #include <cmath> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 #include "components/favicon_base/select_favicon_frames.h" | 28 #include "components/favicon_base/select_favicon_frames.h" |
| 29 #include "components/prefs/pref_service.h" | 29 #include "components/prefs/pref_service.h" |
| 30 #include "content/public/browser/render_view_host.h" | 30 #include "content/public/browser/render_view_host.h" |
| 31 #include "content/public/browser/render_widget_host_view.h" | 31 #include "content/public/browser/render_widget_host_view.h" |
| 32 #include "content/public/browser/web_contents.h" | 32 #include "content/public/browser/web_contents.h" |
| 33 #include "extensions/common/extension.h" | 33 #include "extensions/common/extension.h" |
| 34 #include "net/base/load_flags.h" | 34 #include "net/base/load_flags.h" |
| 35 #include "net/url_request/url_request.h" | 35 #include "net/url_request/url_request.h" |
| 36 #include "skia/ext/image_operations.h" | 36 #include "skia/ext/image_operations.h" |
| 37 #include "third_party/skia/include/core/SkBitmap.h" | 37 #include "third_party/skia/include/core/SkBitmap.h" |
| 38 #include "third_party/skia/include/core/SkPaint.h" | |
| 39 #include "third_party/skia/include/core/SkRect.h" | 38 #include "third_party/skia/include/core/SkRect.h" |
| 40 #include "ui/base/l10n/l10n_util.h" | 39 #include "ui/base/l10n/l10n_util.h" |
| 41 #include "ui/base/layout.h" | 40 #include "ui/base/layout.h" |
| 42 #include "ui/base/resource/resource_bundle.h" | 41 #include "ui/base/resource/resource_bundle.h" |
| 43 #include "ui/gfx/canvas.h" | 42 #include "ui/gfx/canvas.h" |
| 44 #include "ui/gfx/codec/png_codec.h" | 43 #include "ui/gfx/codec/png_codec.h" |
| 45 #include "ui/gfx/image/image_family.h" | 44 #include "ui/gfx/image/image_family.h" |
| 46 #include "ui/gfx/image/image_skia.h" | 45 #include "ui/gfx/image/image_skia.h" |
| 47 #include "ui/views/controls/button/checkbox.h" | 46 #include "ui/views/controls/button/checkbox.h" |
| 48 #include "ui/views/controls/image_view.h" | 47 #include "ui/views/controls/image_view.h" |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 void AppInfoView::OnPaint(gfx::Canvas* canvas) { | 176 void AppInfoView::OnPaint(gfx::Canvas* canvas) { |
| 178 gfx::Rect bounds = GetLocalBounds(); | 177 gfx::Rect bounds = GetLocalBounds(); |
| 179 | 178 |
| 180 SkRect border_rect = { | 179 SkRect border_rect = { |
| 181 SkIntToScalar(bounds.x()), | 180 SkIntToScalar(bounds.x()), |
| 182 SkIntToScalar(bounds.y()), | 181 SkIntToScalar(bounds.y()), |
| 183 SkIntToScalar(bounds.right()), | 182 SkIntToScalar(bounds.right()), |
| 184 SkIntToScalar(bounds.bottom()) | 183 SkIntToScalar(bounds.bottom()) |
| 185 }; | 184 }; |
| 186 | 185 |
| 187 cc::PaintFlags border_paint; | 186 cc::PaintFlags border_flags; |
| 188 border_paint.setAntiAlias(true); | 187 border_flags.setAntiAlias(true); |
| 189 border_paint.setARGB(0xFF, 0xC8, 0xC8, 0xC8); | 188 border_flags.setARGB(0xFF, 0xC8, 0xC8, 0xC8); |
| 190 | 189 |
| 191 canvas->sk_canvas()->drawRoundRect(border_rect, SkIntToScalar(2), | 190 canvas->sk_canvas()->drawRoundRect(border_rect, SkIntToScalar(2), |
| 192 SkIntToScalar(2), border_paint); | 191 SkIntToScalar(2), border_flags); |
| 193 | 192 |
| 194 SkRect inner_rect = { | 193 SkRect inner_rect = { |
| 195 border_rect.fLeft + SkDoubleToScalar(0.5), | 194 border_rect.fLeft + SkDoubleToScalar(0.5), |
| 196 border_rect.fTop + SkDoubleToScalar(0.5), | 195 border_rect.fTop + SkDoubleToScalar(0.5), |
| 197 border_rect.fRight - SkDoubleToScalar(0.5), | 196 border_rect.fRight - SkDoubleToScalar(0.5), |
| 198 border_rect.fBottom - SkDoubleToScalar(0.5), | 197 border_rect.fBottom - SkDoubleToScalar(0.5), |
| 199 }; | 198 }; |
| 200 | 199 |
| 201 cc::PaintFlags inner_paint; | 200 cc::PaintFlags inner_flags; |
| 202 inner_paint.setAntiAlias(true); | 201 inner_flags.setAntiAlias(true); |
| 203 inner_paint.setARGB(0xFF, 0xF8, 0xF8, 0xF8); | 202 inner_flags.setARGB(0xFF, 0xF8, 0xF8, 0xF8); |
| 204 canvas->sk_canvas()->drawRoundRect(inner_rect, SkDoubleToScalar(1.5), | 203 canvas->sk_canvas()->drawRoundRect(inner_rect, SkDoubleToScalar(1.5), |
| 205 SkDoubleToScalar(1.5), inner_paint); | 204 SkDoubleToScalar(1.5), inner_flags); |
| 206 } | 205 } |
| 207 | 206 |
| 208 } // namespace | 207 } // namespace |
| 209 | 208 |
| 210 namespace chrome { | 209 namespace chrome { |
| 211 | 210 |
| 212 void ShowCreateWebAppShortcutsDialog(gfx::NativeWindow parent_window, | 211 void ShowCreateWebAppShortcutsDialog(gfx::NativeWindow parent_window, |
| 213 content::WebContents* web_contents) { | 212 content::WebContents* web_contents) { |
| 214 constrained_window::CreateBrowserModalDialogViews( | 213 constrained_window::CreateBrowserModalDialogViews( |
| 215 new CreateUrlApplicationShortcutView(web_contents), | 214 new CreateUrlApplicationShortcutView(web_contents), |
| (...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 539 bool CreateChromeApplicationShortcutView::Cancel() { | 538 bool CreateChromeApplicationShortcutView::Cancel() { |
| 540 if (!close_callback_.is_null()) | 539 if (!close_callback_.is_null()) |
| 541 close_callback_.Run(false); | 540 close_callback_.Run(false); |
| 542 return CreateApplicationShortcutView::Cancel(); | 541 return CreateApplicationShortcutView::Cancel(); |
| 543 } | 542 } |
| 544 | 543 |
| 545 void CreateChromeApplicationShortcutView::OnAppInfoLoaded( | 544 void CreateChromeApplicationShortcutView::OnAppInfoLoaded( |
| 546 std::unique_ptr<web_app::ShortcutInfo> shortcut_info) { | 545 std::unique_ptr<web_app::ShortcutInfo> shortcut_info) { |
| 547 shortcut_info_ = std::move(shortcut_info); | 546 shortcut_info_ = std::move(shortcut_info); |
| 548 } | 547 } |
| OLD | NEW |