OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 UI_VIEWS_TEST_TEST_VIEWS_DELEGATE_H_ | 5 #ifndef UI_VIEWS_TEST_TEST_VIEWS_DELEGATE_H_ |
6 #define UI_VIEWS_TEST_TEST_VIEWS_DELEGATE_H_ | 6 #define UI_VIEWS_TEST_TEST_VIEWS_DELEGATE_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "build/build_config.h" | 11 #include "build/build_config.h" |
12 #include "ui/base/accessibility/accessibility_types.h" | 12 #include "ui/base/accessibility/accessibility_types.h" |
13 #include "views/views_delegate.h" | 13 #include "views/views_delegate.h" |
14 | 14 |
15 namespace ui { | 15 namespace ui { |
16 class Clipboard; | 16 class Clipboard; |
17 } | 17 } |
18 | 18 |
19 namespace views { | 19 namespace views { |
20 class View; | 20 class View; |
21 class Widget; | 21 class Widget; |
22 | 22 |
23 class TestViewsDelegate : public ViewsDelegate { | 23 class TestViewsDelegate : public ViewsDelegate { |
24 public: | 24 public: |
25 TestViewsDelegate(); | 25 TestViewsDelegate(); |
26 virtual ~TestViewsDelegate(); | 26 virtual ~TestViewsDelegate(); |
27 | 27 |
28 void set_default_parent_view(View* view) { | |
29 default_parent_view_ = view; | |
30 } | |
31 | |
32 // Overridden from ViewsDelegate: | 28 // Overridden from ViewsDelegate: |
33 virtual ui::Clipboard* GetClipboard() const OVERRIDE; | 29 virtual ui::Clipboard* GetClipboard() const OVERRIDE; |
34 virtual View* GetDefaultParentView() OVERRIDE; | |
35 virtual void SaveWindowPlacement(const Widget* window, | 30 virtual void SaveWindowPlacement(const Widget* window, |
36 const std::string& window_name, | 31 const std::string& window_name, |
37 const gfx::Rect& bounds, | 32 const gfx::Rect& bounds, |
38 ui::WindowShowState show_state) OVERRIDE; | 33 ui::WindowShowState show_state) OVERRIDE; |
39 virtual bool GetSavedWindowPlacement( | 34 virtual bool GetSavedWindowPlacement( |
40 const std::string& window_name, | 35 const std::string& window_name, |
41 gfx::Rect* bounds, | 36 gfx::Rect* bounds, |
42 ui::WindowShowState* show_state) const OVERRIDE; | 37 ui::WindowShowState* show_state) const OVERRIDE; |
43 | 38 |
44 virtual void NotifyAccessibilityEvent( | 39 virtual void NotifyAccessibilityEvent( |
45 View* view, ui::AccessibilityTypes::Event event_type) OVERRIDE {} | 40 View* view, ui::AccessibilityTypes::Event event_type) OVERRIDE {} |
46 | 41 |
47 virtual void NotifyMenuItemFocused(const string16& menu_name, | 42 virtual void NotifyMenuItemFocused(const string16& menu_name, |
48 const string16& menu_item_name, | 43 const string16& menu_item_name, |
49 int item_index, | 44 int item_index, |
50 int item_count, | 45 int item_count, |
51 bool has_submenu) OVERRIDE {} | 46 bool has_submenu) OVERRIDE {} |
52 #if defined(OS_WIN) | 47 #if defined(OS_WIN) |
53 virtual HICON GetDefaultWindowIcon() const OVERRIDE { | 48 virtual HICON GetDefaultWindowIcon() const OVERRIDE { |
54 return NULL; | 49 return NULL; |
55 } | 50 } |
56 #endif | 51 #endif |
57 | 52 |
58 virtual void AddRef() OVERRIDE {} | 53 virtual void AddRef() OVERRIDE {} |
59 virtual void ReleaseRef() OVERRIDE {} | 54 virtual void ReleaseRef() OVERRIDE {} |
60 | 55 |
61 virtual int GetDispositionForEvent(int event_flags) OVERRIDE; | 56 virtual int GetDispositionForEvent(int event_flags) OVERRIDE; |
62 | 57 |
63 private: | 58 private: |
64 View* default_parent_view_; | |
65 mutable scoped_ptr<ui::Clipboard> clipboard_; | 59 mutable scoped_ptr<ui::Clipboard> clipboard_; |
66 | 60 |
67 DISALLOW_COPY_AND_ASSIGN(TestViewsDelegate); | 61 DISALLOW_COPY_AND_ASSIGN(TestViewsDelegate); |
68 }; | 62 }; |
69 | 63 |
70 } // namespace views | 64 } // namespace views |
71 | 65 |
72 #endif // UI_VIEWS_TEST_TEST_VIEWS_DELEGATE_H_ | 66 #endif // UI_VIEWS_TEST_TEST_VIEWS_DELEGATE_H_ |
OLD | NEW |