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

Side by Side Diff: chrome/browser/ui/views/chrome_views_delegate.h

Issue 2758323002: Broke out layout metric information from ViewsDelegate to LayoutProvider (Closed)
Patch Set: Fix warning which causes one of the bots to fail Created 3 years, 8 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 #ifndef CHROME_BROWSER_UI_VIEWS_CHROME_VIEWS_DELEGATE_H_ 5 #ifndef CHROME_BROWSER_UI_VIEWS_CHROME_VIEWS_DELEGATE_H_
6 #define CHROME_BROWSER_UI_VIEWS_CHROME_VIEWS_DELEGATE_H_ 6 #define CHROME_BROWSER_UI_VIEWS_CHROME_VIEWS_DELEGATE_H_
7 7
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/location.h" 10 #include "base/location.h"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "build/build_config.h" 12 #include "build/build_config.h"
13 #include "chrome/browser/ui/views/harmony/chrome_layout_delegate.h"
13 #include "ui/accessibility/ax_enums.h" 14 #include "ui/accessibility/ax_enums.h"
14 #include "ui/views/views_delegate.h" 15 #include "ui/views/views_delegate.h"
15 16
16 class ScopedKeepAlive; 17 class ScopedKeepAlive;
17 18
18 class ChromeViewsDelegate : public views::ViewsDelegate { 19 class ChromeViewsDelegate : public views::ViewsDelegate {
19 public: 20 public:
20 ChromeViewsDelegate(); 21 ChromeViewsDelegate();
21 ~ChromeViewsDelegate() override; 22 ~ChromeViewsDelegate() override;
22 23
23 static ChromeViewsDelegate* GetInstance();
24
25 // views::ViewsDelegate: 24 // views::ViewsDelegate:
26 void SaveWindowPlacement(const views::Widget* window, 25 void SaveWindowPlacement(const views::Widget* window,
27 const std::string& window_name, 26 const std::string& window_name,
28 const gfx::Rect& bounds, 27 const gfx::Rect& bounds,
29 ui::WindowShowState show_state) override; 28 ui::WindowShowState show_state) override;
30 bool GetSavedWindowPlacement(const views::Widget* widget, 29 bool GetSavedWindowPlacement(const views::Widget* widget,
31 const std::string& window_name, 30 const std::string& window_name,
32 gfx::Rect* bounds, 31 gfx::Rect* bounds,
33 ui::WindowShowState* show_state) const override; 32 ui::WindowShowState* show_state) const override;
34 void NotifyAccessibilityEvent(views::View* view, 33 void NotifyAccessibilityEvent(views::View* view,
(...skipping 18 matching lines...) Expand all
53 void AddRef() override; 52 void AddRef() override;
54 void ReleaseRef() override; 53 void ReleaseRef() override;
55 void OnBeforeWidgetInit( 54 void OnBeforeWidgetInit(
56 views::Widget::InitParams* params, 55 views::Widget::InitParams* params,
57 views::internal::NativeWidgetDelegate* delegate) override; 56 views::internal::NativeWidgetDelegate* delegate) override;
58 ui::ContextFactory* GetContextFactory() override; 57 ui::ContextFactory* GetContextFactory() override;
59 ui::ContextFactoryPrivate* GetContextFactoryPrivate() override; 58 ui::ContextFactoryPrivate* GetContextFactoryPrivate() override;
60 std::string GetApplicationName() override; 59 std::string GetApplicationName() override;
61 scoped_refptr<base::TaskRunner> GetBlockingPoolTaskRunner() override; 60 scoped_refptr<base::TaskRunner> GetBlockingPoolTaskRunner() override;
62 61
63 gfx::Insets GetInsetsMetric(views::InsetsMetric metric) const override;
64 int GetDistanceMetric(views::DistanceMetric metric) const override;
65 const views::TypographyProvider& GetTypographyProvider() const override;
66
67 static int GetDefaultDistanceMetric(views::DistanceMetric metric);
68
69 private: 62 private:
70 #if defined(OS_WIN) 63 #if defined(OS_WIN)
71 typedef std::map<HMONITOR, int> AppbarAutohideEdgeMap; 64 typedef std::map<HMONITOR, int> AppbarAutohideEdgeMap;
72 65
73 // Callback on main thread with the edges. |returned_edges| is the value that 66 // Callback on main thread with the edges. |returned_edges| is the value that
74 // was returned from the call to GetAutohideEdges() that initiated the lookup. 67 // was returned from the call to GetAutohideEdges() that initiated the lookup.
75 void OnGotAppbarAutohideEdges(const base::Closure& callback, 68 void OnGotAppbarAutohideEdges(const base::Closure& callback,
76 HMONITOR monitor, 69 HMONITOR monitor,
77 int returned_edges, 70 int returned_edges,
78 int edges); 71 int edges);
79 #endif 72 #endif
80 73
81 #if defined(OS_CHROMEOS) 74 #if defined(OS_CHROMEOS)
82 // Called from GetSavedWindowPlacement() on ChromeOS to adjust the bounds. 75 // Called from GetSavedWindowPlacement() on ChromeOS to adjust the bounds.
83 void AdjustSavedWindowPlacementChromeOS(const views::Widget* widget, 76 void AdjustSavedWindowPlacementChromeOS(const views::Widget* widget,
84 gfx::Rect* bounds) const; 77 gfx::Rect* bounds) const;
85 #endif 78 #endif
86 79
87 int InternalGetDefaultDistanceMetric(views::DistanceMetric metric) const;
88
89 // Function to retrieve default opacity value mainly based on platform 80 // Function to retrieve default opacity value mainly based on platform
90 // and desktop context. 81 // and desktop context.
91 views::Widget::InitParams::WindowOpacity GetOpacityForInitParams( 82 views::Widget::InitParams::WindowOpacity GetOpacityForInitParams(
92 const views::Widget::InitParams& params); 83 const views::Widget::InitParams& params);
93 84
94 views::NativeWidget* CreateNativeWidget( 85 views::NativeWidget* CreateNativeWidget(
95 views::Widget::InitParams* params, 86 views::Widget::InitParams* params,
96 views::internal::NativeWidgetDelegate* delegate); 87 views::internal::NativeWidgetDelegate* delegate);
97 88
98 // |ChromeViewsDelegate| exposes a |RefCounted|-like interface, but //chrome 89 // |ChromeViewsDelegate| exposes a |RefCounted|-like interface, but //chrome
99 // uses |ScopedKeepAlive|s to manage lifetime. We manage an internal counter 90 // uses |ScopedKeepAlive|s to manage lifetime. We manage an internal counter
100 // to do that translation. 91 // to do that translation.
101 unsigned int ref_count_ = 0u; 92 unsigned int ref_count_ = 0u;
102 93
103 std::unique_ptr<ScopedKeepAlive> keep_alive_; 94 std::unique_ptr<ScopedKeepAlive> keep_alive_;
104 95
96 // std::unique_ptr<ChromeLayoutDelegate> layout_delegate_ =
97 // base::MakeUnique<ChromeLayoutDelegate>();
Peter Kasting 2017/04/06 08:13:36 Don't add this block
kylix_rd 2017/04/06 16:48:19 It's gone in subsequent patches.
98
105 #if defined(OS_WIN) 99 #if defined(OS_WIN)
106 AppbarAutohideEdgeMap appbar_autohide_edge_map_; 100 AppbarAutohideEdgeMap appbar_autohide_edge_map_;
107 // If true we're in the process of notifying a callback from 101 // If true we're in the process of notifying a callback from
108 // GetAutohideEdges().start a new query. 102 // GetAutohideEdges().start a new query.
109 bool in_autohide_edges_callback_; 103 bool in_autohide_edges_callback_;
110 104
111 base::WeakPtrFactory<ChromeViewsDelegate> weak_factory_; 105 base::WeakPtrFactory<ChromeViewsDelegate> weak_factory_;
112 #endif 106 #endif
113 107
114 DISALLOW_COPY_AND_ASSIGN(ChromeViewsDelegate); 108 DISALLOW_COPY_AND_ASSIGN(ChromeViewsDelegate);
115 }; 109 };
116 110
117 #endif // CHROME_BROWSER_UI_VIEWS_CHROME_VIEWS_DELEGATE_H_ 111 #endif // CHROME_BROWSER_UI_VIEWS_CHROME_VIEWS_DELEGATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698