| 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 #include "ui/views/test/test_views_delegate.h" | 5 #include "ui/views/test/test_views_delegate.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "ui/base/clipboard/clipboard.h" | 8 #include "ui/base/clipboard/clipboard.h" |
| 9 | 9 |
| 10 namespace views { | 10 namespace views { |
| 11 | 11 |
| 12 TestViewsDelegate::TestViewsDelegate() | 12 TestViewsDelegate::TestViewsDelegate() { |
| 13 : default_parent_view_(NULL) { | |
| 14 DCHECK(!ViewsDelegate::views_delegate); | 13 DCHECK(!ViewsDelegate::views_delegate); |
| 15 ViewsDelegate::views_delegate = this; | 14 ViewsDelegate::views_delegate = this; |
| 16 } | 15 } |
| 17 | 16 |
| 18 TestViewsDelegate::~TestViewsDelegate() { | 17 TestViewsDelegate::~TestViewsDelegate() { |
| 19 ViewsDelegate::views_delegate = NULL; | 18 ViewsDelegate::views_delegate = NULL; |
| 20 } | 19 } |
| 21 | 20 |
| 22 ui::Clipboard* TestViewsDelegate::GetClipboard() const { | 21 ui::Clipboard* TestViewsDelegate::GetClipboard() const { |
| 23 if (!clipboard_.get()) { | 22 if (!clipboard_.get()) { |
| 24 // Note that we need a MessageLoop for the next call to work. | 23 // Note that we need a MessageLoop for the next call to work. |
| 25 clipboard_.reset(new ui::Clipboard); | 24 clipboard_.reset(new ui::Clipboard); |
| 26 } | 25 } |
| 27 return clipboard_.get(); | 26 return clipboard_.get(); |
| 28 } | 27 } |
| 29 | 28 |
| 30 View* TestViewsDelegate::GetDefaultParentView() { | |
| 31 return default_parent_view_; | |
| 32 } | |
| 33 | |
| 34 void TestViewsDelegate::SaveWindowPlacement(const Widget* window, | 29 void TestViewsDelegate::SaveWindowPlacement(const Widget* window, |
| 35 const std::string& window_name, | 30 const std::string& window_name, |
| 36 const gfx::Rect& bounds, | 31 const gfx::Rect& bounds, |
| 37 ui::WindowShowState show_state) { | 32 ui::WindowShowState show_state) { |
| 38 } | 33 } |
| 39 | 34 |
| 40 bool TestViewsDelegate::GetSavedWindowPlacement( | 35 bool TestViewsDelegate::GetSavedWindowPlacement( |
| 41 const std::string& window_name, | 36 const std::string& window_name, |
| 42 gfx::Rect* bounds, | 37 gfx::Rect* bounds, |
| 43 ui:: WindowShowState* show_state) const { | 38 ui:: WindowShowState* show_state) const { |
| 44 return false; | 39 return false; |
| 45 } | 40 } |
| 46 | 41 |
| 47 int TestViewsDelegate::GetDispositionForEvent(int event_flags) { | 42 int TestViewsDelegate::GetDispositionForEvent(int event_flags) { |
| 48 return 0; | 43 return 0; |
| 49 } | 44 } |
| 50 | 45 |
| 51 } // namespace views | 46 } // namespace views |
| OLD | NEW |