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/compiler_specific.h"
10 #include "build/build_config.h"
11 #include "ui/accessibility/ax_enums.h"
12 #include "ui/views/views_delegate.h"
14 class ChromeViewsDelegate : public views::ViewsDelegate {
16 ChromeViewsDelegate();
17 virtual ~ChromeViewsDelegate();
19 // views::ViewsDelegate:
20 virtual void SaveWindowPlacement(const views::Widget* window,
21 const std::string& window_name,
22 const gfx::Rect& bounds,
23 ui::WindowShowState show_state) OVERRIDE;
24 virtual bool GetSavedWindowPlacement(
25 const views::Widget* widget,
26 const std::string& window_name,
28 ui::WindowShowState* show_state) const OVERRIDE;
29 virtual void NotifyAccessibilityEvent(
30 views::View* view, ui::AXEvent event_type) OVERRIDE;
31 virtual void NotifyMenuItemFocused(const base::string16& menu_name,
32 const base::string16& menu_item_name,
35 bool has_submenu) OVERRIDE;
37 virtual HICON GetDefaultWindowIcon() const OVERRIDE;
38 virtual bool IsWindowInMetro(gfx::NativeWindow window) const OVERRIDE;
39 #elif defined(OS_LINUX) && !defined(OS_CHROMEOS)
40 virtual gfx::ImageSkia* GetDefaultWindowIcon() const OVERRIDE;
43 virtual views::NonClientFrameView* CreateDefaultNonClientFrameView(
44 views::Widget* widget) OVERRIDE;
46 virtual void AddRef() OVERRIDE;
47 virtual void ReleaseRef() OVERRIDE;
48 virtual void OnBeforeWidgetInit(
49 views::Widget::InitParams* params,
50 views::internal::NativeWidgetDelegate* delegate) OVERRIDE;
51 #if defined(OS_LINUX) && !defined(OS_CHROMEOS)
52 virtual bool WindowManagerProvidesTitleBar(bool maximized) OVERRIDE;
55 virtual int GetAppbarAutohideEdges(HMONITOR monitor,
56 const base::Closure& callback) OVERRIDE;
61 typedef std::map<HMONITOR, int> AppbarAutohideEdgeMap;
63 // Callback on main thread with the edges. |returned_edges| is the value that
64 // was returned from the call to GetAutohideEdges() that initiated the lookup.
65 void OnGotAppbarAutohideEdges(const base::Closure& callback,
71 // Function to retrieve default opacity value mainly based on platform
72 // and desktop context.
73 views::Widget::InitParams::WindowOpacity GetOpacityForInitParams(
74 const views::Widget::InitParams& params);
77 AppbarAutohideEdgeMap appbar_autohide_edge_map_;
78 base::WeakPtrFactory<ChromeViewsDelegate> weak_factory_;
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_;
84 DISALLOW_COPY_AND_ASSIGN(ChromeViewsDelegate);
87 #endif // CHROME_BROWSER_UI_VIEWS_CHROME_VIEWS_DELEGATE_H_