Index: ui/views/focus_border.cc |
diff --git a/ui/views/focus_border.cc b/ui/views/focus_border.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..790256bdf399458e4bc413cafe8d3e6e526f6f79 |
--- /dev/null |
+++ b/ui/views/focus_border.cc |
@@ -0,0 +1,56 @@ |
+// Copyright (c) 2012 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. |
+ |
+#include "ui/views/focus_border.h" |
+ |
+#include "ui/gfx/canvas.h" |
+#include "ui/gfx/rect.h" |
+#include "ui/views/view.h" |
+ |
+namespace views { |
+namespace { |
+class DashedFocusBorder : public FocusBorder { |
+ public: |
+ DashedFocusBorder( |
+ int left_inset, int top_inset, int right_inset, int bottom_inset) |
+ : left_inset_(left_inset), |
+ top_inset_(top_inset), |
+ right_inset_(right_inset), |
+ bottom_inset_(bottom_inset) { |
+ } |
+ |
+ virtual void Paint(const View& view, gfx::Canvas* canvas) const { |
+ gfx::Rect rect(view.GetLocalBounds()); |
+ rect.Inset(left_inset_, top_inset_, right_inset_, bottom_inset_); |
+ canvas->DrawFocusRect(rect); |
+ } |
+ |
+ private: |
+ int left_inset_; |
+ int top_inset_; |
+ int right_inset_; |
+ int bottom_inset_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(DashedFocusBorder); |
+}; |
+} // namespace |
+ |
+FocusBorder::~FocusBorder() { |
+} |
+ |
+// static |
+FocusBorder* FocusBorder::CreateDashedFocusBorder() { |
+ return new DashedFocusBorder(0, 0, 0, 0); |
+} |
+ |
+// static |
+FocusBorder* FocusBorder::CreateDashedFocusBorder( |
+ int left, int top, int right, int bottom) { |
+ return new DashedFocusBorder(left, top, right, bottom); |
+} |
+ |
+FocusBorder::FocusBorder() { |
+} |
+ |
+} // namespace views |