| 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 "components/security_state/core/security_state.h" | 9 #include "components/security_state/core/security_state.h" |
| 10 #include "ui/gfx/canvas.h" | 10 #include "ui/gfx/canvas.h" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 } | 56 } |
| 57 | 57 |
| 58 } // namespace | 58 } // namespace |
| 59 | 59 |
| 60 UrlBarTexture::UrlBarTexture() : security_level_(SecurityLevel::DANGEROUS) {} | 60 UrlBarTexture::UrlBarTexture() : security_level_(SecurityLevel::DANGEROUS) {} |
| 61 | 61 |
| 62 UrlBarTexture::~UrlBarTexture() = default; | 62 UrlBarTexture::~UrlBarTexture() = default; |
| 63 | 63 |
| 64 void UrlBarTexture::SetURL(const GURL& gurl) { | 64 void UrlBarTexture::SetURL(const GURL& gurl) { |
| 65 if (gurl_ != gurl) | 65 if (gurl_ != gurl) |
| 66 dirty_ = true; | 66 set_dirty(); |
| 67 gurl_ = gurl; | 67 gurl_ = gurl; |
| 68 } | 68 } |
| 69 | 69 |
| 70 void UrlBarTexture::SetSecurityLevel(int level) { | 70 void UrlBarTexture::SetSecurityLevel(int level) { |
| 71 if (&getSecurityIcon(security_level_) != &getSecurityIcon(level)) | 71 if (&getSecurityIcon(security_level_) != &getSecurityIcon(level)) |
| 72 dirty_ = true; | 72 set_dirty(); |
| 73 security_level_ = level; | 73 security_level_ = level; |
| 74 } | 74 } |
| 75 | 75 |
| 76 float UrlBarTexture::ToPixels(float meters) const { | 76 float UrlBarTexture::ToPixels(float meters) const { |
| 77 return meters * size_.width() / kWidth; | 77 return meters * size_.width() / kWidth; |
| 78 } | 78 } |
| 79 | 79 |
| 80 void UrlBarTexture::Draw(SkCanvas* canvas, const gfx::Size& texture_size) { | 80 void UrlBarTexture::Draw(SkCanvas* canvas, const gfx::Size& texture_size) { |
| 81 size_.set_height(texture_size.height()); | 81 size_.set_height(texture_size.height()); |
| 82 size_.set_width(texture_size.width()); | 82 size_.set_width(texture_size.width()); |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 gfx::Size UrlBarTexture::GetPreferredTextureSize(int maximum_width) const { | 159 gfx::Size UrlBarTexture::GetPreferredTextureSize(int maximum_width) const { |
| 160 return gfx::Size(maximum_width, maximum_width * kHeight / kWidth); | 160 return gfx::Size(maximum_width, maximum_width * kHeight / kWidth); |
| 161 } | 161 } |
| 162 | 162 |
| 163 gfx::SizeF UrlBarTexture::GetDrawnSize() const { | 163 gfx::SizeF UrlBarTexture::GetDrawnSize() const { |
| 164 return size_; | 164 return size_; |
| 165 } | 165 } |
| 166 | 166 |
| 167 bool UrlBarTexture::SetDrawFlags(int draw_flags) { | 167 bool UrlBarTexture::SetDrawFlags(int draw_flags) { |
| 168 if (draw_flags != GetDrawFlags()) | 168 if (draw_flags != GetDrawFlags()) |
| 169 dirty_ = true; | 169 set_dirty(); |
| 170 return UiTexture::SetDrawFlags(draw_flags); | 170 return UiTexture::SetDrawFlags(draw_flags); |
| 171 } | 171 } |
| 172 | 172 |
| 173 } // namespace vr_shell | 173 } // namespace vr_shell |
| OLD | NEW |