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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_UI_VIEWS_CHROME_VIEWS_DELEGATE_H_
6 #define CHROME_BROWSER_UI_VIEWS_CHROME_VIEWS_DELEGATE_H_
8 #include "base/basictypes.h"
9 #include "base/callback.h"
10 #include "base/compiler_specific.h"
11 #include "base/location.h"
12 #include "build/build_config.h"
13 #include "ui/accessibility/ax_enums.h"
14 #include "ui/views/views_delegate.h"
16 class ChromeViewsDelegate
: public views::ViewsDelegate
{
18 ChromeViewsDelegate();
19 ~ChromeViewsDelegate() override
;
21 // views::ViewsDelegate:
22 void SaveWindowPlacement(const views::Widget
* window
,
23 const std::string
& window_name
,
24 const gfx::Rect
& bounds
,
25 ui::WindowShowState show_state
) override
;
26 bool GetSavedWindowPlacement(const views::Widget
* widget
,
27 const std::string
& window_name
,
29 ui::WindowShowState
* show_state
) const override
;
30 void NotifyAccessibilityEvent(views::View
* view
,
31 ui::AXEvent event_type
) override
;
33 HICON
GetDefaultWindowIcon() const override
;
34 HICON
GetSmallWindowIcon() const override
;
35 bool IsWindowInMetro(gfx::NativeWindow window
) const override
;
36 #elif defined(OS_LINUX) && !defined(OS_CHROMEOS)
37 gfx::ImageSkia
* GetDefaultWindowIcon() const override
;
41 views::NonClientFrameView
* CreateDefaultNonClientFrameView(
42 views::Widget
* widget
) override
;
44 void AddRef() override
;
45 void ReleaseRef() override
;
46 void OnBeforeWidgetInit(
47 views::Widget::InitParams
* params
,
48 views::internal::NativeWidgetDelegate
* delegate
) override
;
49 #if defined(OS_LINUX) && !defined(OS_CHROMEOS)
50 bool WindowManagerProvidesTitleBar(bool maximized
) override
;
52 ui::ContextFactory
* GetContextFactory() override
;
53 std::string
GetApplicationName() override
;
55 int GetAppbarAutohideEdges(HMONITOR monitor
,
56 const base::Closure
& callback
) override
;
58 scoped_refptr
<base::TaskRunner
> GetBlockingPoolTaskRunner() override
;
62 typedef std::map
<HMONITOR
, int> AppbarAutohideEdgeMap
;
64 // Callback on main thread with the edges. |returned_edges| is the value that
65 // was returned from the call to GetAutohideEdges() that initiated the lookup.
66 void OnGotAppbarAutohideEdges(const base::Closure
& callback
,
72 // Function to retrieve default opacity value mainly based on platform
73 // and desktop context.
74 views::Widget::InitParams::WindowOpacity
GetOpacityForInitParams(
75 const views::Widget::InitParams
& params
);
78 AppbarAutohideEdgeMap appbar_autohide_edge_map_
;
79 // If true we're in the process of notifying a callback from
80 // GetAutohideEdges().start a new query.
81 bool in_autohide_edges_callback_
;
83 base::WeakPtrFactory
<ChromeViewsDelegate
> weak_factory_
;
86 DISALLOW_COPY_AND_ASSIGN(ChromeViewsDelegate
);
89 #endif // CHROME_BROWSER_UI_VIEWS_CHROME_VIEWS_DELEGATE_H_