Index: chrome/browser/ui/views/location_bar/background_with_1_px_border.h |
diff --git a/chrome/browser/ui/views/location_bar/background_with_1_px_border.h b/chrome/browser/ui/views/location_bar/background_with_1_px_border.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..588b3f539883563561c65a614f3e82db3de5db7c |
--- /dev/null |
+++ b/chrome/browser/ui/views/location_bar/background_with_1_px_border.h |
@@ -0,0 +1,47 @@ |
+// Copyright 2015 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_BACKGROUND_WITH_1_PX_BORDER_H_ |
+#define CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_BACKGROUND_WITH_1_PX_BORDER_H_ |
+ |
+#include "base/macros.h" |
+#include "third_party/skia/include/core/SkColor.h" |
+#include "ui/views/background.h" |
+ |
+namespace gfx { |
+class Canvas; |
+} |
+ |
+namespace views { |
+class View; |
+} |
+ |
+// BackgroundWith1PxBorder renders a solid background color, with a one pixel |
+// border. This accounts for the scaling of the canvas, so that the border is |
+// one pixel regardless of display scaling. When created for popup mode, the |
+// border will be a rectangle, unless the window is maximized. A maximized popup |
+// will remove the horizontal edges of the border. |
+// |
+// When created for non popups, the border will have rounded corners. |
+class BackgroundWith1PxBorder : public views::Background { |
+ public: |
+ BackgroundWith1PxBorder(SkColor background, |
+ SkColor border, |
+ bool is_popup_mode); |
+ |
+ void Paint(gfx::Canvas* canvas, views::View* view) const override; |
+ |
+ private: |
+ // Color for the one pixel border. |
+ SkColor border_color_; |
+ |
+ // If true the border will be a rectangle, and will not render the horizontal |
+ // edges when the window is maximized. If false the border will have rounded |
+ // corners. |
+ bool is_popup_mode_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(BackgroundWith1PxBorder); |
+}; |
+ |
+#endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_BACKGROUND_WITH_1_PX_BORDER_H_ |