Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2656)

Unified Diff: athena/main/athena_views_delegate.cc

Issue 597543002: Fix crash which occurs when combining AthenaTestBase tests and other tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« athena/main/athena_views_delegate.h ('K') | « athena/main/athena_views_delegate.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: athena/main/athena_views_delegate.cc
diff --git a/athena/main/athena_views_delegate.cc b/athena/main/athena_views_delegate.cc
index 3f30cda33e35af3a88e70c88c49760c34dbbcb2e..44f9a04560cc9a20676eeb61b0844b8a551f2c8f 100644
--- a/athena/main/athena_views_delegate.cc
+++ b/athena/main/athena_views_delegate.cc
@@ -6,18 +6,49 @@
#include "athena/main/athena_frame_view.h"
#include "athena/screen/public/screen_manager.h"
+#include "ui/views/views_delegate.h"
namespace athena {
-void AthenaViewsDelegate::OnBeforeWidgetInit(
- views::Widget::InitParams* params,
- views::internal::NativeWidgetDelegate* delegate) {
- params->context = athena::ScreenManager::Get()->GetContext();
+namespace {
+
+class AthenaViewsDelegateImpl : public AthenaViewsDelegate,
oshima 2014/09/23 20:35:53 and you don't have to extend AthenaViewsDelegate.
pkotwicz 2014/09/23 20:44:38 Oshima, do you think that it is worth AthenaViewsD
oshima 2014/09/23 20:49:56 SGTM
+ public views::ViewsDelegate {
+ public:
+ AthenaViewsDelegateImpl() {
+ }
+
+ virtual ~AthenaViewsDelegateImpl() {
+ }
+
+ virtual void OnBeforeWidgetInit(
+ views::Widget::InitParams* params,
+ views::internal::NativeWidgetDelegate* delegate) OVERRIDE {
+ params->context = athena::ScreenManager::Get()->GetContext();
+ }
+
+ virtual views::NonClientFrameView* CreateDefaultNonClientFrameView(
+ views::Widget* widget) OVERRIDE {
+ return new AthenaFrameView(widget);
+ }
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(AthenaViewsDelegateImpl);
+};
+
+} // namespace
+
+// static
+views::ViewsDelegate* AthenaViewsDelegate::Create() {
+ views::ViewsDelegate::views_delegate = new AthenaViewsDelegateImpl;
+ return views::ViewsDelegate::views_delegate;
}
-views::NonClientFrameView* AthenaViewsDelegate::CreateDefaultNonClientFrameView(
- views::Widget* widget) {
- return new AthenaFrameView(widget);
+// static
+void AthenaViewsDelegate::Shutdown() {
+ CHECK(views::ViewsDelegate::views_delegate);
+ delete views::ViewsDelegate::views_delegate;
+ views::ViewsDelegate::views_delegate = NULL;
}
} // namespace athena
« athena/main/athena_views_delegate.h ('K') | « athena/main/athena_views_delegate.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698