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 #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 "ui/accessibility/ax_enums.h" | 13 #include "ui/accessibility/ax_enums.h" |
14 #include "ui/views/views_delegate.h" | 14 #include "ui/views/views_delegate.h" |
15 | 15 |
16 class ScopedKeepAlive; | 16 class ScopedKeepAlive; |
17 | 17 |
18 class ChromeViewsDelegate : public views::ViewsDelegate { | 18 class ChromeViewsDelegate : public views::ViewsDelegate { |
19 public: | 19 public: |
20 ChromeViewsDelegate(); | 20 ChromeViewsDelegate(); |
21 ~ChromeViewsDelegate() override; | 21 ~ChromeViewsDelegate() override; |
22 | 22 |
| 23 static ChromeViewsDelegate* GetInstance(); |
| 24 |
23 // views::ViewsDelegate: | 25 // views::ViewsDelegate: |
24 void SaveWindowPlacement(const views::Widget* window, | 26 void SaveWindowPlacement(const views::Widget* window, |
25 const std::string& window_name, | 27 const std::string& window_name, |
26 const gfx::Rect& bounds, | 28 const gfx::Rect& bounds, |
27 ui::WindowShowState show_state) override; | 29 ui::WindowShowState show_state) override; |
28 bool GetSavedWindowPlacement(const views::Widget* widget, | 30 bool GetSavedWindowPlacement(const views::Widget* widget, |
29 const std::string& window_name, | 31 const std::string& window_name, |
30 gfx::Rect* bounds, | 32 gfx::Rect* bounds, |
31 ui::WindowShowState* show_state) const override; | 33 ui::WindowShowState* show_state) const override; |
32 void NotifyAccessibilityEvent(views::View* view, | 34 void NotifyAccessibilityEvent(views::View* view, |
(...skipping 18 matching lines...) Expand all Loading... |
51 void AddRef() override; | 53 void AddRef() override; |
52 void ReleaseRef() override; | 54 void ReleaseRef() override; |
53 void OnBeforeWidgetInit( | 55 void OnBeforeWidgetInit( |
54 views::Widget::InitParams* params, | 56 views::Widget::InitParams* params, |
55 views::internal::NativeWidgetDelegate* delegate) override; | 57 views::internal::NativeWidgetDelegate* delegate) override; |
56 ui::ContextFactory* GetContextFactory() override; | 58 ui::ContextFactory* GetContextFactory() override; |
57 ui::ContextFactoryPrivate* GetContextFactoryPrivate() override; | 59 ui::ContextFactoryPrivate* GetContextFactoryPrivate() override; |
58 std::string GetApplicationName() override; | 60 std::string GetApplicationName() override; |
59 scoped_refptr<base::TaskRunner> GetBlockingPoolTaskRunner() override; | 61 scoped_refptr<base::TaskRunner> GetBlockingPoolTaskRunner() override; |
60 | 62 |
61 gfx::Insets GetDialogButtonInsets() const override; | 63 gfx::Insets GetInsetsMetric(views::InsetsMetric metric) const override; |
62 int GetDialogCloseButtonMargin() const override; | 64 int GetDistanceMetric(views::DistanceMetric metric) const override; |
63 int GetDialogRelatedButtonHorizontalSpacing() const override; | 65 |
64 int GetDialogRelatedControlVerticalSpacing() const override; | 66 int GetDefaultDistanceMetric(views::DistanceMetric metric) const; |
65 gfx::Insets GetDialogFrameViewInsets() const override; | |
66 gfx::Insets GetBubbleDialogMargins() const override; | |
67 int GetButtonMinimumWidth() const override; | |
68 int GetDialogButtonMinimumWidth() const override; | |
69 int GetButtonHorizontalPadding() const override; | |
70 | 67 |
71 private: | 68 private: |
72 #if defined(OS_WIN) | 69 #if defined(OS_WIN) |
73 typedef std::map<HMONITOR, int> AppbarAutohideEdgeMap; | 70 typedef std::map<HMONITOR, int> AppbarAutohideEdgeMap; |
74 | 71 |
75 // Callback on main thread with the edges. |returned_edges| is the value that | 72 // Callback on main thread with the edges. |returned_edges| is the value that |
76 // was returned from the call to GetAutohideEdges() that initiated the lookup. | 73 // was returned from the call to GetAutohideEdges() that initiated the lookup. |
77 void OnGotAppbarAutohideEdges(const base::Closure& callback, | 74 void OnGotAppbarAutohideEdges(const base::Closure& callback, |
78 HMONITOR monitor, | 75 HMONITOR monitor, |
79 int returned_edges, | 76 int returned_edges, |
(...skipping 28 matching lines...) Expand all Loading... |
108 // GetAutohideEdges().start a new query. | 105 // GetAutohideEdges().start a new query. |
109 bool in_autohide_edges_callback_; | 106 bool in_autohide_edges_callback_; |
110 | 107 |
111 base::WeakPtrFactory<ChromeViewsDelegate> weak_factory_; | 108 base::WeakPtrFactory<ChromeViewsDelegate> weak_factory_; |
112 #endif | 109 #endif |
113 | 110 |
114 DISALLOW_COPY_AND_ASSIGN(ChromeViewsDelegate); | 111 DISALLOW_COPY_AND_ASSIGN(ChromeViewsDelegate); |
115 }; | 112 }; |
116 | 113 |
117 #endif // CHROME_BROWSER_UI_VIEWS_CHROME_VIEWS_DELEGATE_H_ | 114 #endif // CHROME_BROWSER_UI_VIEWS_CHROME_VIEWS_DELEGATE_H_ |
OLD | NEW |