| 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" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 views::Widget::InitParams* params, | 56 views::Widget::InitParams* params, |
| 57 views::internal::NativeWidgetDelegate* delegate) override; | 57 views::internal::NativeWidgetDelegate* delegate) override; |
| 58 ui::ContextFactory* GetContextFactory() override; | 58 ui::ContextFactory* GetContextFactory() override; |
| 59 ui::ContextFactoryPrivate* GetContextFactoryPrivate() override; | 59 ui::ContextFactoryPrivate* GetContextFactoryPrivate() override; |
| 60 std::string GetApplicationName() override; | 60 std::string GetApplicationName() override; |
| 61 scoped_refptr<base::TaskRunner> GetBlockingPoolTaskRunner() override; | 61 scoped_refptr<base::TaskRunner> GetBlockingPoolTaskRunner() override; |
| 62 | 62 |
| 63 gfx::Insets GetInsetsMetric(views::InsetsMetric metric) const override; | 63 gfx::Insets GetInsetsMetric(views::InsetsMetric metric) const override; |
| 64 int GetDistanceMetric(views::DistanceMetric metric) const override; | 64 int GetDistanceMetric(views::DistanceMetric metric) const override; |
| 65 | 65 |
| 66 int GetDefaultDistanceMetric(views::DistanceMetric metric) const; | 66 static int GetDefaultDistanceMetric(views::DistanceMetric metric); |
| 67 | 67 |
| 68 private: | 68 private: |
| 69 #if defined(OS_WIN) | 69 #if defined(OS_WIN) |
| 70 typedef std::map<HMONITOR, int> AppbarAutohideEdgeMap; | 70 typedef std::map<HMONITOR, int> AppbarAutohideEdgeMap; |
| 71 | 71 |
| 72 // 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 |
| 73 // was returned from the call to GetAutohideEdges() that initiated the lookup. | 73 // was returned from the call to GetAutohideEdges() that initiated the lookup. |
| 74 void OnGotAppbarAutohideEdges(const base::Closure& callback, | 74 void OnGotAppbarAutohideEdges(const base::Closure& callback, |
| 75 HMONITOR monitor, | 75 HMONITOR monitor, |
| 76 int returned_edges, | 76 int returned_edges, |
| 77 int edges); | 77 int edges); |
| 78 #endif | 78 #endif |
| 79 | 79 |
| 80 #if defined(OS_CHROMEOS) | 80 #if defined(OS_CHROMEOS) |
| 81 // Called from GetSavedWindowPlacement() on ChromeOS to adjust the bounds. | 81 // Called from GetSavedWindowPlacement() on ChromeOS to adjust the bounds. |
| 82 void AdjustSavedWindowPlacementChromeOS(const views::Widget* widget, | 82 void AdjustSavedWindowPlacementChromeOS(const views::Widget* widget, |
| 83 gfx::Rect* bounds) const; | 83 gfx::Rect* bounds) const; |
| 84 #endif | 84 #endif |
| 85 | 85 |
| 86 int InternalGetDefaultDistanceMetric(views::DistanceMetric metric) const; |
| 87 |
| 86 // Function to retrieve default opacity value mainly based on platform | 88 // Function to retrieve default opacity value mainly based on platform |
| 87 // and desktop context. | 89 // and desktop context. |
| 88 views::Widget::InitParams::WindowOpacity GetOpacityForInitParams( | 90 views::Widget::InitParams::WindowOpacity GetOpacityForInitParams( |
| 89 const views::Widget::InitParams& params); | 91 const views::Widget::InitParams& params); |
| 90 | 92 |
| 91 views::NativeWidget* CreateNativeWidget( | 93 views::NativeWidget* CreateNativeWidget( |
| 92 views::Widget::InitParams* params, | 94 views::Widget::InitParams* params, |
| 93 views::internal::NativeWidgetDelegate* delegate); | 95 views::internal::NativeWidgetDelegate* delegate); |
| 94 | 96 |
| 95 // |ChromeViewsDelegate| exposes a |RefCounted|-like interface, but //chrome | 97 // |ChromeViewsDelegate| exposes a |RefCounted|-like interface, but //chrome |
| 96 // uses |ScopedKeepAlive|s to manage lifetime. We manage an internal counter | 98 // uses |ScopedKeepAlive|s to manage lifetime. We manage an internal counter |
| 97 // to do that translation. | 99 // to do that translation. |
| 98 unsigned int ref_count_ = 0u; | 100 unsigned int ref_count_ = 0u; |
| 99 | 101 |
| 100 std::unique_ptr<ScopedKeepAlive> keep_alive_; | 102 std::unique_ptr<ScopedKeepAlive> keep_alive_; |
| 101 | 103 |
| 102 #if defined(OS_WIN) | 104 #if defined(OS_WIN) |
| 103 AppbarAutohideEdgeMap appbar_autohide_edge_map_; | 105 AppbarAutohideEdgeMap appbar_autohide_edge_map_; |
| 104 // If true we're in the process of notifying a callback from | 106 // If true we're in the process of notifying a callback from |
| 105 // GetAutohideEdges().start a new query. | 107 // GetAutohideEdges().start a new query. |
| 106 bool in_autohide_edges_callback_; | 108 bool in_autohide_edges_callback_; |
| 107 | 109 |
| 108 base::WeakPtrFactory<ChromeViewsDelegate> weak_factory_; | 110 base::WeakPtrFactory<ChromeViewsDelegate> weak_factory_; |
| 109 #endif | 111 #endif |
| 110 | 112 |
| 111 DISALLOW_COPY_AND_ASSIGN(ChromeViewsDelegate); | 113 DISALLOW_COPY_AND_ASSIGN(ChromeViewsDelegate); |
| 112 }; | 114 }; |
| 113 | 115 |
| 114 #endif // CHROME_BROWSER_UI_VIEWS_CHROME_VIEWS_DELEGATE_H_ | 116 #endif // CHROME_BROWSER_UI_VIEWS_CHROME_VIEWS_DELEGATE_H_ |
| OLD | NEW |