OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/wrench_menu.h" | 5 #include "chrome/browser/ui/views/wrench_menu.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 | 8 |
9 #include "base/string_number_conversions.h" | 9 #include "base/string_number_conversions.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 | 227 |
228 // A View subclass that forces SchedulePaint to paint all. Normally when the | 228 // A View subclass that forces SchedulePaint to paint all. Normally when the |
229 // mouse enters/exits a button the buttons invokes SchedulePaint. As part of the | 229 // mouse enters/exits a button the buttons invokes SchedulePaint. As part of the |
230 // button border (MenuButtonBackground) is rendered by the button to the | 230 // button border (MenuButtonBackground) is rendered by the button to the |
231 // left/right of it SchedulePaint on the the button may not be enough, so this | 231 // left/right of it SchedulePaint on the the button may not be enough, so this |
232 // forces a paint all. | 232 // forces a paint all. |
233 class ScheduleAllView : public views::View { | 233 class ScheduleAllView : public views::View { |
234 public: | 234 public: |
235 ScheduleAllView() {} | 235 ScheduleAllView() {} |
236 | 236 |
237 #if !defined(COMPOSITOR_2) | |
238 virtual void SchedulePaintInRect(const gfx::Rect& r) { | |
239 if (!IsVisible()) | |
240 return; | |
241 | |
242 if (parent()) | |
243 parent()->SchedulePaintInRect(GetMirroredBounds()); | |
244 } | |
245 #else | |
246 virtual void SchedulePaintInRect(const gfx::Rect& r) { | 237 virtual void SchedulePaintInRect(const gfx::Rect& r) { |
247 View::SchedulePaintInRect(gfx::Rect(0, 0, width(), height())); | 238 View::SchedulePaintInRect(gfx::Rect(0, 0, width(), height())); |
248 } | 239 } |
249 | 240 |
250 virtual void SchedulePaintInternal(const gfx::Rect& r) { | 241 virtual void SchedulePaintInternal(const gfx::Rect& r) { |
251 View::SchedulePaintInternal(gfx::Rect(0, 0, width(), height())); | 242 View::SchedulePaintInternal(gfx::Rect(0, 0, width(), height())); |
252 } | 243 } |
253 #endif | |
254 | 244 |
255 private: | 245 private: |
256 DISALLOW_COPY_AND_ASSIGN(ScheduleAllView); | 246 DISALLOW_COPY_AND_ASSIGN(ScheduleAllView); |
257 }; | 247 }; |
258 | 248 |
259 string16 GetAccessibleNameForWrenchMenuItem( | 249 string16 GetAccessibleNameForWrenchMenuItem( |
260 MenuModel* model, int item_index, int accessible_string_id) { | 250 MenuModel* model, int item_index, int accessible_string_id) { |
261 string16 accessible_name = l10n_util::GetStringUTF16(accessible_string_id); | 251 string16 accessible_name = l10n_util::GetStringUTF16(accessible_string_id); |
262 string16 accelerator_text; | 252 string16 accelerator_text; |
263 | 253 |
(...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
865 model->AddObserver(this); | 855 model->AddObserver(this); |
866 bookmark_menu_delegate_.reset( | 856 bookmark_menu_delegate_.reset( |
867 new BookmarkMenuDelegate(browser_->profile(), | 857 new BookmarkMenuDelegate(browser_->profile(), |
868 NULL, | 858 NULL, |
869 browser_->window()->GetNativeHandle(), | 859 browser_->window()->GetNativeHandle(), |
870 first_bookmark_command_id_)); | 860 first_bookmark_command_id_)); |
871 bookmark_menu_delegate_->Init( | 861 bookmark_menu_delegate_->Init( |
872 this, bookmark_menu_, model->GetBookmarkBarNode(), 0, | 862 this, bookmark_menu_, model->GetBookmarkBarNode(), 0, |
873 BookmarkMenuDelegate::SHOW_OTHER_FOLDER); | 863 BookmarkMenuDelegate::SHOW_OTHER_FOLDER); |
874 } | 864 } |
OLD | NEW |