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

Side by Side Diff: views/desktop/desktop_window_view.cc

Issue 7585028: NativeWidgetViews: Implement widget activation/deactivation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 4 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | views/widget/native_widget_views.h » ('j') | views/widget/widget_unittest.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "views/desktop/desktop_window_view.h" 5 #include "views/desktop/desktop_window_view.h"
6 6
7 #include "ui/gfx/canvas.h" 7 #include "ui/gfx/canvas.h"
8 #include "ui/gfx/transform.h" 8 #include "ui/gfx/transform.h"
9 #include "views/desktop/desktop_background.h" 9 #include "views/desktop/desktop_background.h"
10 #include "views/desktop/desktop_window_root_view.h" 10 #include "views/desktop/desktop_window_root_view.h"
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 #endif 131 #endif
132 window->Init(params); 132 window->Init(params);
133 window->Show(); 133 window->Show();
134 window->Maximize(); 134 window->Maximize();
135 } 135 }
136 136
137 void DesktopWindowView::ActivateWidget(Widget* widget) { 137 void DesktopWindowView::ActivateWidget(Widget* widget) {
138 if (widget && widget->IsActive()) 138 if (widget && widget->IsActive())
139 return; 139 return;
140 140
141 if (active_native_widget_)
142 active_native_widget_->OnActivate(false);
143 if (widget) { 141 if (widget) {
144 widget->MoveToTop();
145 active_native_widget_ =
146 static_cast<NativeWidgetViews*>(widget->native_widget());
147 active_native_widget_->OnActivate(true);
148 if (!widget->HasObserver(this)) 142 if (!widget->HasObserver(this))
149 widget->AddObserver(this); 143 widget->AddObserver(this);
144 widget->Activate();
150 } 145 }
151 } 146 }
152 147
153 148
154 void DesktopWindowView::CreateTestWindow(const std::wstring& title, 149 void DesktopWindowView::CreateTestWindow(const std::wstring& title,
155 SkColor color, 150 SkColor color,
156 gfx::Rect initial_bounds, 151 gfx::Rect initial_bounds,
157 bool rotate) { 152 bool rotate) {
158 views::Widget* window = views::Widget::CreateWindowWithBounds( 153 views::Widget* window = views::Widget::CreateWindowWithBounds(
159 new TestWindowContentView(title, color), 154 new TestWindowContentView(title, color),
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 (active_native_widget_)->GetWidget() == widget) 240 (active_native_widget_)->GetWidget() == widget)
246 active_native_widget_ = NULL; 241 active_native_widget_ = NULL;
247 } 242 }
248 243
249 void DesktopWindowView::OnWidgetVisibilityChanged(Widget* widget, 244 void DesktopWindowView::OnWidgetVisibilityChanged(Widget* widget,
250 bool visible) { 245 bool visible) {
251 } 246 }
252 247
253 void DesktopWindowView::OnWidgetActivationChanged(Widget* widget, 248 void DesktopWindowView::OnWidgetActivationChanged(Widget* widget,
254 bool active) { 249 bool active) {
250 if (active) {
251 if (active_native_widget_)
252 active_native_widget_->GetWidget()->Deactivate();
253 active_native_widget_ =
254 static_cast<NativeWidgetViews*>(widget->native_widget());
255 } else if (widget == active_native_widget_->GetWidget()) {
256 active_native_widget_ = NULL;
257 }
255 } 258 }
256 259
257 } // namespace desktop 260 } // namespace desktop
258 } // namespace views 261 } // namespace views
OLDNEW
« no previous file with comments | « no previous file | views/widget/native_widget_views.h » ('j') | views/widget/widget_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698