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 "ash/system/network/tray_network.h" | 5 #include "ash/system/network/tray_network.h" |
6 | 6 |
7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
8 #include "ash/system/tray/system_tray.h" | 8 #include "ash/system/tray/system_tray.h" |
9 #include "ash/system/tray/system_tray_delegate.h" | 9 #include "ash/system/tray/system_tray_delegate.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 } | 107 } |
108 | 108 |
109 ViewClickListener* listener_; | 109 ViewClickListener* listener_; |
110 | 110 |
111 DISALLOW_COPY_AND_ASSIGN(HoverHighlightView); | 111 DISALLOW_COPY_AND_ASSIGN(HoverHighlightView); |
112 }; | 112 }; |
113 | 113 |
114 // A custom scroll-view that has a specified dimension. | 114 // A custom scroll-view that has a specified dimension. |
115 class FixedSizedScrollView : public views::ScrollView { | 115 class FixedSizedScrollView : public views::ScrollView { |
116 public: | 116 public: |
117 FixedSizedScrollView() {} | 117 FixedSizedScrollView() { |
| 118 set_focusable(true); |
| 119 set_notify_enter_exit_on_child(true); |
| 120 } |
| 121 |
118 virtual ~FixedSizedScrollView() {} | 122 virtual ~FixedSizedScrollView() {} |
119 | 123 |
120 void SetContentsView(View* view) { | 124 void SetContentsView(View* view) { |
121 SetContents(view); | 125 SetContents(view); |
122 view->SetBoundsRect(gfx::Rect(view->GetPreferredSize())); | 126 view->SetBoundsRect(gfx::Rect(view->GetPreferredSize())); |
123 } | 127 } |
124 | 128 |
125 void set_fixed_size(gfx::Size size) { fixed_size_ = size; } | 129 void set_fixed_size(gfx::Size size) { fixed_size_ = size; } |
126 | 130 |
127 private: | 131 private: |
128 // Overridden from views::View. | 132 // Overridden from views::View. |
129 virtual gfx::Size GetPreferredSize() OVERRIDE { | 133 virtual gfx::Size GetPreferredSize() OVERRIDE { |
130 return fixed_size_; | 134 return fixed_size_; |
131 } | 135 } |
132 | 136 |
| 137 virtual void OnBoundsChanged(const gfx::Rect& previous_bounds) OVERRIDE { |
| 138 views::View* contents = GetContents(); |
| 139 gfx::Rect bounds = contents->bounds(); |
| 140 bounds.set_width(width() - GetScrollBarWidth()); |
| 141 contents->SetBoundsRect(bounds); |
| 142 } |
| 143 |
| 144 virtual void OnMouseEntered(const views::MouseEvent& event) OVERRIDE { |
| 145 RequestFocus(); |
| 146 } |
| 147 |
| 148 virtual void OnPaintFocusBorder(gfx::Canvas* canvas) OVERRIDE { |
| 149 // Do not paint the focus border. |
| 150 } |
| 151 |
133 gfx::Size fixed_size_; | 152 gfx::Size fixed_size_; |
134 | 153 |
135 DISALLOW_COPY_AND_ASSIGN(FixedSizedScrollView); | 154 DISALLOW_COPY_AND_ASSIGN(FixedSizedScrollView); |
136 }; | 155 }; |
137 | 156 |
138 } | 157 } |
139 | 158 |
140 namespace ash { | 159 namespace ash { |
141 namespace internal { | 160 namespace internal { |
142 | 161 |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
382 if (tray_.get()) | 401 if (tray_.get()) |
383 tray_->Update(info); | 402 tray_->Update(info); |
384 if (default_.get()) | 403 if (default_.get()) |
385 default_->Update(info); | 404 default_->Update(info); |
386 if (detailed_.get()) | 405 if (detailed_.get()) |
387 detailed_->Update(); | 406 detailed_->Update(); |
388 } | 407 } |
389 | 408 |
390 } // namespace internal | 409 } // namespace internal |
391 } // namespace ash | 410 } // namespace ash |
OLD | NEW |