OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/ui/views/location_bar/zoom_bubble_view.h" | 5 #include "chrome/browser/ui/views/location_bar/zoom_bubble_view.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "grit/generated_resources.h" | 9 #include "grit/generated_resources.h" |
10 #include "ui/base/l10n/l10n_util.h" | 10 #include "ui/base/l10n/l10n_util.h" |
11 #include "ui/views/layout/fill_layout.h" | 11 #include "ui/views/layout/fill_layout.h" |
| 12 #include "ui/views/widget/widget.h" |
12 | 13 |
13 namespace { | 14 namespace { |
14 | 15 |
15 // The number of milliseconds the bubble should stay on the screen for if it | 16 // The number of milliseconds the bubble should stay on the screen for if it |
16 // will automatically close. | 17 // will automatically close. |
17 const int kBubbleCloseDelay = 400; | 18 const int kBubbleCloseDelay = 400; |
18 | 19 |
19 } | 20 } // namespace |
20 | 21 |
21 // static | 22 // static |
22 ZoomBubbleView* ZoomBubbleView::zoom_bubble_ = NULL; | 23 ZoomBubbleView* ZoomBubbleView::zoom_bubble_ = NULL; |
23 | 24 |
24 // static | 25 // static |
25 void ZoomBubbleView::ShowBubble(views::View* anchor_view, | 26 void ZoomBubbleView::ShowBubble(views::View* anchor_view, |
26 int zoom_percent, | 27 int zoom_percent, |
27 bool auto_close) { | 28 bool auto_close) { |
28 // If the bubble is already showing in this window and its |auto_close_| value | 29 // If the bubble is already showing in this window and its |auto_close_| value |
29 // is equal to |auto_close|, the bubble can be reused and only the label text | 30 // is equal to |auto_close|, the bubble can be reused and only the label text |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 base::TimeDelta::FromMilliseconds(kBubbleCloseDelay), | 94 base::TimeDelta::FromMilliseconds(kBubbleCloseDelay), |
94 this, | 95 this, |
95 &ZoomBubbleView::Close); | 96 &ZoomBubbleView::Close); |
96 } | 97 } |
97 } | 98 } |
98 | 99 |
99 void ZoomBubbleView::WindowClosing() { | 100 void ZoomBubbleView::WindowClosing() { |
100 DCHECK(zoom_bubble_ == this); | 101 DCHECK(zoom_bubble_ == this); |
101 zoom_bubble_ = NULL; | 102 zoom_bubble_ = NULL; |
102 } | 103 } |
OLD | NEW |