| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 VIEWS_VIEWS_DELEGATE_H_ | 5 #ifndef VIEWS_VIEWS_DELEGATE_H_ |
| 6 #define VIEWS_VIEWS_DELEGATE_H_ | 6 #define VIEWS_VIEWS_DELEGATE_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #if defined(OS_WIN) | 10 #if defined(OS_WIN) |
| 11 #include <windows.h> | 11 #include <windows.h> |
| 12 #endif | 12 #endif |
| 13 | 13 |
| 14 #include "views/accessibility/accessibility_types.h" | |
| 15 | |
| 16 class Clipboard; | 14 class Clipboard; |
| 17 | 15 |
| 18 namespace gfx { | 16 namespace gfx { |
| 19 class Rect; | 17 class Rect; |
| 20 } | 18 } |
| 21 | 19 |
| 22 namespace views { | 20 namespace views { |
| 23 | 21 |
| 24 class View; | |
| 25 | |
| 26 // ViewsDelegate is an interface implemented by an object using the views | 22 // ViewsDelegate is an interface implemented by an object using the views |
| 27 // framework. It is used to obtain various high level application utilities | 23 // framework. It is used to obtain various high level application utilities |
| 28 // and perform some actions such as window placement saving. | 24 // and perform some actions such as window placement saving. |
| 29 // | 25 // |
| 30 // The embedding app must set views_delegate to assign its ViewsDelegate | 26 // The embedding app must set views_delegate to assign its ViewsDelegate |
| 31 // implementation. | 27 // implementation. |
| 32 class ViewsDelegate { | 28 class ViewsDelegate { |
| 33 public: | 29 public: |
| 34 virtual ~ViewsDelegate() {} | 30 virtual ~ViewsDelegate() {} |
| 35 | 31 |
| 36 // Gets the clipboard. | 32 // Gets the clipboard. |
| 37 virtual Clipboard* GetClipboard() const = 0; | 33 virtual Clipboard* GetClipboard() const = 0; |
| 38 | 34 |
| 39 // Saves the position, size and maximized state for the window with the | 35 // Saves the position, size and maximized state for the window with the |
| 40 // specified name. | 36 // specified name. |
| 41 virtual void SaveWindowPlacement(const std::wstring& window_name, | 37 virtual void SaveWindowPlacement(const std::wstring& window_name, |
| 42 const gfx::Rect& bounds, | 38 const gfx::Rect& bounds, |
| 43 bool maximized) = 0; | 39 bool maximized) = 0; |
| 44 | 40 |
| 45 // Retrieves the saved position and size for the window with the specified | 41 // Retrieves the saved position and size for the window with the specified |
| 46 // name. | 42 // name. |
| 47 virtual bool GetSavedWindowBounds(const std::wstring& window_name, | 43 virtual bool GetSavedWindowBounds(const std::wstring& window_name, |
| 48 gfx::Rect* bounds) const = 0; | 44 gfx::Rect* bounds) const = 0; |
| 49 | 45 |
| 50 // Retrieves the saved maximized state for the window with the specified | 46 // Retrieves the saved maximized state for the window with the specified |
| 51 // name. | 47 // name. |
| 52 virtual bool GetSavedMaximizedState(const std::wstring& window_name, | 48 virtual bool GetSavedMaximizedState(const std::wstring& window_name, |
| 53 bool* maximized) const = 0; | 49 bool* maximized) const = 0; |
| 54 | 50 |
| 55 // Notify the delegate that an accessibility event has happened in | |
| 56 // a particular view. | |
| 57 virtual void NotifyAccessibilityEvent( | |
| 58 views::View* view, AccessibilityTypes::Event event_type) = 0; | |
| 59 | |
| 60 #if defined(OS_WIN) | 51 #if defined(OS_WIN) |
| 61 // Retrieves the default window icon to use for windows if none is specified. | 52 // Retrieves the default window icon to use for windows if none is specified. |
| 62 virtual HICON GetDefaultWindowIcon() const = 0; | 53 virtual HICON GetDefaultWindowIcon() const = 0; |
| 63 #endif | 54 #endif |
| 64 | 55 |
| 65 // AddRef/ReleaseRef are invoked while a menu is visible. They are used to | 56 // AddRef/ReleaseRef are invoked while a menu is visible. They are used to |
| 66 // ensure we don't attempt to exit while a menu is showing. | 57 // ensure we don't attempt to exit while a menu is showing. |
| 67 virtual void AddRef() = 0; | 58 virtual void AddRef() = 0; |
| 68 virtual void ReleaseRef() = 0; | 59 virtual void ReleaseRef() = 0; |
| 69 | 60 |
| 70 // The active ViewsDelegate used by the views system. | 61 // The active ViewsDelegate used by the views system. |
| 71 static ViewsDelegate* views_delegate; | 62 static ViewsDelegate* views_delegate; |
| 72 }; | 63 }; |
| 73 | 64 |
| 74 } // namespace views | 65 } // namespace views |
| 75 | 66 |
| 76 #endif // VIEWS_VIEWS_DELEGATE_H_ | 67 #endif // VIEWS_VIEWS_DELEGATE_H_ |
| OLD | NEW |