| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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/vr_shell/textures/url_bar_texture.h" | 5 #include "chrome/browser/android/vr_shell/textures/url_bar_texture.h" |
| 6 | 6 |
| 7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "cc/paint/skia_paint_canvas.h" | 8 #include "cc/paint/skia_paint_canvas.h" |
| 9 #include "ui/gfx/canvas.h" | 9 #include "ui/gfx/canvas.h" |
| 10 #include "ui/gfx/font.h" | 10 #include "ui/gfx/font.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 } // namespace | 41 } // namespace |
| 42 | 42 |
| 43 UrlBarTexture::UrlBarTexture() = default; | 43 UrlBarTexture::UrlBarTexture() = default; |
| 44 | 44 |
| 45 UrlBarTexture::~UrlBarTexture() = default; | 45 UrlBarTexture::~UrlBarTexture() = default; |
| 46 | 46 |
| 47 void UrlBarTexture::SetHover(bool hover) { | 47 void UrlBarTexture::SetHover(bool hover) { |
| 48 hover_ = hover; | 48 hover_ = hover; |
| 49 } | 49 } |
| 50 | 50 |
| 51 void UrlBarTexture::SetGURL(const GURL& gurl) { | 51 void UrlBarTexture::SetURL(const GURL& gurl) { |
| 52 gurl_ = gurl; | 52 gurl_ = gurl; |
| 53 } | 53 } |
| 54 | 54 |
| 55 float UrlBarTexture::ToPixels(float meters) const { | 55 float UrlBarTexture::ToPixels(float meters) const { |
| 56 return meters * size_.width() / kWidth; | 56 return meters * size_.width() / kWidth; |
| 57 } | 57 } |
| 58 | 58 |
| 59 void UrlBarTexture::Draw(SkCanvas* canvas, const gfx::Size& texture_size) { | 59 void UrlBarTexture::Draw(SkCanvas* canvas, const gfx::Size& texture_size) { |
| 60 size_.set_height(texture_size.height()); | 60 size_.set_height(texture_size.height()); |
| 61 size_.set_width(texture_size.width()); | 61 size_.set_width(texture_size.width()); |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 | 132 |
| 133 gfx::Size UrlBarTexture::GetPreferredTextureSize(int maximum_width) const { | 133 gfx::Size UrlBarTexture::GetPreferredTextureSize(int maximum_width) const { |
| 134 return gfx::Size(maximum_width, maximum_width * kHeight / kWidth); | 134 return gfx::Size(maximum_width, maximum_width * kHeight / kWidth); |
| 135 } | 135 } |
| 136 | 136 |
| 137 gfx::SizeF UrlBarTexture::GetDrawnSize() const { | 137 gfx::SizeF UrlBarTexture::GetDrawnSize() const { |
| 138 return size_; | 138 return size_; |
| 139 } | 139 } |
| 140 | 140 |
| 141 } // namespace vr_shell | 141 } // namespace vr_shell |
| OLD | NEW |