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

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

Issue 2613343002: Allow a View to specify a non-default native theme (i.e. different from (Closed)
Patch Set: docs Created 3 years, 11 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
« no previous file with comments | « chrome/browser/ui/views/infobars/confirm_infobar.cc ('k') | ui/views/view.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #ifndef UI_VIEWS_VIEW_H_ 5 #ifndef UI_VIEWS_VIEW_H_
6 #define UI_VIEWS_VIEW_H_ 6 #define UI_VIEWS_VIEW_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after
532 // The border object is owned by this object and may be NULL. 532 // The border object is owned by this object and may be NULL.
533 virtual void SetBorder(std::unique_ptr<Border> b); 533 virtual void SetBorder(std::unique_ptr<Border> b);
534 const Border* border() const { return border_.get(); } 534 const Border* border() const { return border_.get(); }
535 Border* border() { return border_.get(); } 535 Border* border() { return border_.get(); }
536 536
537 // Get the theme provider from the parent widget. 537 // Get the theme provider from the parent widget.
538 const ui::ThemeProvider* GetThemeProvider() const; 538 const ui::ThemeProvider* GetThemeProvider() const;
539 539
540 // Returns the NativeTheme to use for this View. This calls through to 540 // Returns the NativeTheme to use for this View. This calls through to
541 // GetNativeTheme() on the Widget this View is in, or provides a default 541 // GetNativeTheme() on the Widget this View is in, or provides a default
542 // theme if there's no widget. Warning: the default theme might not be 542 // theme if there's no widget, or returns |native_theme_override_| if that's
543 // correct; you should probably override OnNativeThemeChanged(). 543 // set. Warning: the default theme might not be correct; you should probably
544 // override OnNativeThemeChanged().
544 ui::NativeTheme* GetNativeTheme() { 545 ui::NativeTheme* GetNativeTheme() {
545 return const_cast<ui::NativeTheme*>( 546 return const_cast<ui::NativeTheme*>(
546 const_cast<const View*>(this)->GetNativeTheme()); 547 const_cast<const View*>(this)->GetNativeTheme());
547 } 548 }
548 const ui::NativeTheme* GetNativeTheme() const; 549 const ui::NativeTheme* GetNativeTheme() const;
549 550
551 // Sets the native theme override and informs descendants.
sky 2017/01/09 16:13:52 I'm not sure 'override' buys much here. How about
Evan Stade 2017/01/09 17:36:26 Done.
552 void SetNativeThemeOverride(ui::NativeTheme* theme);
553
550 // RTL painting -------------------------------------------------------------- 554 // RTL painting --------------------------------------------------------------
551 555
552 // This method determines whether the gfx::Canvas object passed to 556 // This method determines whether the gfx::Canvas object passed to
553 // View::Paint() needs to be transformed such that anything drawn on the 557 // View::Paint() needs to be transformed such that anything drawn on the
554 // canvas object during View::Paint() is flipped horizontally. 558 // canvas object during View::Paint() is flipped horizontally.
555 bool flip_canvas_on_paint_for_rtl_ui() const { 559 bool flip_canvas_on_paint_for_rtl_ui() const {
556 return flip_canvas_on_paint_for_rtl_ui_; 560 return flip_canvas_on_paint_for_rtl_ui_;
557 } 561 }
558 562
559 // Enables or disables flipping of the gfx::Canvas during View::Paint(). 563 // Enables or disables flipping of the gfx::Canvas during View::Paint().
(...skipping 980 matching lines...) Expand 10 before | Expand all | Expand 10 after
1540 1544
1541 // Background 1545 // Background
1542 std::unique_ptr<Background> background_; 1546 std::unique_ptr<Background> background_;
1543 1547
1544 // Border. 1548 // Border.
1545 std::unique_ptr<Border> border_; 1549 std::unique_ptr<Border> border_;
1546 1550
1547 // Cached output of painting to be reused in future frames until invalidated. 1551 // Cached output of painting to be reused in future frames until invalidated.
1548 ui::PaintCache paint_cache_; 1552 ui::PaintCache paint_cache_;
1549 1553
1554 // Native theme --------------------------------------------------------------
1555
1556 // A non-default native theme for this view and its descendants. When null,
1557 // the native theme is drawn from the parent view (eventually the widget).
1558 ui::NativeTheme* native_theme_override_ = nullptr;
1559
1550 // RTL painting -------------------------------------------------------------- 1560 // RTL painting --------------------------------------------------------------
1551 1561
1552 // Indicates whether or not the gfx::Canvas object passed to View::Paint() 1562 // Indicates whether or not the gfx::Canvas object passed to View::Paint()
1553 // is going to be flipped horizontally (using the appropriate transform) on 1563 // is going to be flipped horizontally (using the appropriate transform) on
1554 // right-to-left locales for this View. 1564 // right-to-left locales for this View.
1555 bool flip_canvas_on_paint_for_rtl_ui_; 1565 bool flip_canvas_on_paint_for_rtl_ui_;
1556 1566
1557 // Accelerated painting ------------------------------------------------------ 1567 // Accelerated painting ------------------------------------------------------
1558 1568
1559 bool paint_to_layer_; 1569 bool paint_to_layer_;
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
1602 // Observers ------------------------------------------------------------- 1612 // Observers -------------------------------------------------------------
1603 1613
1604 base::ObserverList<ViewObserver> observers_; 1614 base::ObserverList<ViewObserver> observers_;
1605 1615
1606 DISALLOW_COPY_AND_ASSIGN(View); 1616 DISALLOW_COPY_AND_ASSIGN(View);
1607 }; 1617 };
1608 1618
1609 } // namespace views 1619 } // namespace views
1610 1620
1611 #endif // UI_VIEWS_VIEW_H_ 1621 #endif // UI_VIEWS_VIEW_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/infobars/confirm_infobar.cc ('k') | ui/views/view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698