Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(588)

Side by Side Diff: ui/views/view.cc

Issue 2744463002: Add VectorIconButton functionality to ImageButton. (Closed)
Patch Set: WIP: use observer Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #define _USE_MATH_DEFINES // For VC++ to get M_PI. This has to be first. 5 #define _USE_MATH_DEFINES // For VC++ to get M_PI. This has to be first.
6 6
7 #include "ui/views/view.h" 7 #include "ui/views/view.h"
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <cmath> 10 #include <cmath>
(...skipping 2017 matching lines...) Expand 10 before | Expand all | Expand 10 after
2028 2028
2029 void View::PropagateNativeThemeChanged(const ui::NativeTheme* theme) { 2029 void View::PropagateNativeThemeChanged(const ui::NativeTheme* theme) {
2030 if (native_theme_ && native_theme_ != theme) 2030 if (native_theme_ && native_theme_ != theme)
2031 return; 2031 return;
2032 2032
2033 { 2033 {
2034 internal::ScopedChildrenLock lock(this); 2034 internal::ScopedChildrenLock lock(this);
2035 for (auto* child : children_) 2035 for (auto* child : children_)
2036 child->PropagateNativeThemeChanged(theme); 2036 child->PropagateNativeThemeChanged(theme);
2037 } 2037 }
2038 for (ViewObserver& observer : observers_)
2039 observer.OnNativeThemeChanged(this, theme);
2038 OnNativeThemeChanged(theme); 2040 OnNativeThemeChanged(theme);
2039 } 2041 }
2040 2042
2041 // Size and disposition -------------------------------------------------------- 2043 // Size and disposition --------------------------------------------------------
2042 2044
2043 void View::PropagateVisibilityNotifications(View* start, bool is_visible) { 2045 void View::PropagateVisibilityNotifications(View* start, bool is_visible) {
2044 { 2046 {
2045 internal::ScopedChildrenLock lock(this); 2047 internal::ScopedChildrenLock lock(this);
2046 for (auto* child : children_) 2048 for (auto* child : children_)
2047 child->PropagateVisibilityNotifications(start, is_visible); 2049 child->PropagateVisibilityNotifications(start, is_visible);
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after
2494 } 2496 }
2495 2497
2496 // System events --------------------------------------------------------------- 2498 // System events ---------------------------------------------------------------
2497 2499
2498 void View::PropagateThemeChanged() { 2500 void View::PropagateThemeChanged() {
2499 { 2501 {
2500 internal::ScopedChildrenLock lock(this); 2502 internal::ScopedChildrenLock lock(this);
2501 for (auto* child : base::Reversed(children_)) 2503 for (auto* child : base::Reversed(children_))
2502 child->PropagateThemeChanged(); 2504 child->PropagateThemeChanged();
2503 } 2505 }
2506 for (ViewObserver& observer : observers_)
2507 observer.OnThemeChanged(this);
2504 OnThemeChanged(); 2508 OnThemeChanged();
2505 } 2509 }
2506 2510
2507 void View::PropagateLocaleChanged() { 2511 void View::PropagateLocaleChanged() {
2508 { 2512 {
2509 internal::ScopedChildrenLock lock(this); 2513 internal::ScopedChildrenLock lock(this);
2510 for (auto* child : base::Reversed(children_)) 2514 for (auto* child : base::Reversed(children_))
2511 child->PropagateLocaleChanged(); 2515 child->PropagateLocaleChanged();
2512 } 2516 }
2513 OnLocaleChanged(); 2517 OnLocaleChanged();
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
2562 // Message the RootView to do the drag and drop. That way if we're removed 2566 // Message the RootView to do the drag and drop. That way if we're removed
2563 // the RootView can detect it and avoid calling us back. 2567 // the RootView can detect it and avoid calling us back.
2564 gfx::Point widget_location(event.location()); 2568 gfx::Point widget_location(event.location());
2565 ConvertPointToWidget(this, &widget_location); 2569 ConvertPointToWidget(this, &widget_location);
2566 widget->RunShellDrag(this, data, widget_location, drag_operations, source); 2570 widget->RunShellDrag(this, data, widget_location, drag_operations, source);
2567 // WARNING: we may have been deleted. 2571 // WARNING: we may have been deleted.
2568 return true; 2572 return true;
2569 } 2573 }
2570 2574
2571 } // namespace views 2575 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698