Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6372)

Unified Diff: chrome/browser/android/vr_shell/textures/url_bar_texture.cc

Issue 2906403002: Disable back button when stack is empty (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/android/vr_shell/textures/url_bar_texture.cc
diff --git a/chrome/browser/android/vr_shell/textures/url_bar_texture.cc b/chrome/browser/android/vr_shell/textures/url_bar_texture.cc
index 5ebf629b929b4380a87abc9d1b76e09d4c4dbe4f..308d155544b14652086c0fee91b823f9835c6ae2 100644
--- a/chrome/browser/android/vr_shell/textures/url_bar_texture.cc
+++ b/chrome/browser/android/vr_shell/textures/url_bar_texture.cc
@@ -106,6 +106,14 @@ void UrlBarTexture::SetURL(const GURL& gurl) {
gurl_ = gurl;
}
+void UrlBarTexture::SetHistoryButtonsEnabled(bool can_go_back,
+ bool can_go_forward) {
+ // Note: We don't have a forward button in the URL bar.
cjgrant 2017/05/29 16:12:25 Comment disappears with the arg.
ymalik 2017/05/29 17:34:10 Done.
+ if (can_go_back != can_go_back_)
+ set_dirty();
+ can_go_back_ = can_go_back;
+}
+
void UrlBarTexture::SetSecurityLevel(SecurityLevel level) {
if (security_level_ != level)
set_dirty();
@@ -176,9 +184,12 @@ void UrlBarTexture::Draw(SkCanvas* canvas, const gfx::Size& texture_size) {
SkVector rounded_corner = {kHeight / 2, kHeight / 2};
SkVector left_corners[4] = {rounded_corner, {0, 0}, {0, 0}, rounded_corner};
round_rect.setRectRadii({0, 0, kHeight, kHeight}, left_corners);
- SkColor color =
- hovered_ ? color_scheme().background_hover : color_scheme().background;
- color = pressed_ ? color_scheme().background_down : color;
+ SkColor color = color_scheme().background;
+ if (can_go_back_) {
cjgrant 2017/05/29 16:12:25 Can we kill the ternaries here? This would read w
ymalik 2017/05/29 17:34:10 Done.
ymalik 2017/05/29 17:34:10 Done.
+ color =
+ hovered_ ? color_scheme().background_hover : color_scheme().background;
+ color = pressed_ ? color_scheme().background_down : color;
+ }
SkPaint paint;
paint.setColor(color);
canvas->drawRRect(round_rect, paint);
@@ -201,7 +212,9 @@ void UrlBarTexture::Draw(SkCanvas* canvas, const gfx::Size& texture_size) {
int icon_default_height = GetDefaultSizeOfVectorIcon(ui::kBackArrowIcon);
float icon_scale = kBackIconHeight / icon_default_height;
canvas->scale(icon_scale, icon_scale);
- PaintVectorIcon(&gfx_canvas, ui::kBackArrowIcon, color_scheme().foreground);
+ PaintVectorIcon(
+ &gfx_canvas, ui::kBackArrowIcon,
+ can_go_back_ ? color_scheme().foreground : color_scheme().deemphasized);
cjgrant 2017/05/29 16:12:25 deemphasized is a URL text color, right? Shouldn'
ymalik 2017/05/29 17:34:10 Yeah was just here as placeholder. Posted hoverboa
canvas->restore();
// Site security state icon.

Powered by Google App Engine
This is Rietveld 408576698