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

Side by Side Diff: chrome/browser/ui/views/frame/browser_frame_win.cc

Issue 10867096: Make HWNDMessageHandler subclass WindowImpl. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/views/frame/browser_frame_win.h ('k') | ui/views/widget/native_widget_win.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/browser/ui/views/frame/browser_frame_win.h" 5 #include "chrome/browser/ui/views/frame/browser_frame_win.h"
6 6
7 #include <dwmapi.h> 7 #include <dwmapi.h>
8 #include <shellapi.h> 8 #include <shellapi.h>
9 #include <set> 9 #include <set>
10 10
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 // We need to update the glass region on or off before the base class adjusts 192 // We need to update the glass region on or off before the base class adjusts
193 // the window region. 193 // the window region.
194 UpdateDWMFrame(); 194 UpdateDWMFrame();
195 NativeWidgetWin::UpdateFrameAfterFrameChange(); 195 NativeWidgetWin::UpdateFrameAfterFrameChange();
196 } 196 }
197 197
198 bool BrowserFrameWin::PreHandleMSG(UINT message, 198 bool BrowserFrameWin::PreHandleMSG(UINT message,
199 WPARAM w_param, 199 WPARAM w_param,
200 LPARAM l_param, 200 LPARAM l_param,
201 LRESULT* result) { 201 LRESULT* result) {
202 static const UINT metro_navigation_search_message =
203 RegisterWindowMessage(chrome::kMetroNavigationAndSearchMessage);
204
205 static const UINT metro_get_current_tab_info_message =
206 RegisterWindowMessage(chrome::kMetroGetCurrentTabInfoMessage);
207
208 if (message == metro_navigation_search_message) {
209 HandleMetroNavSearchRequest(w_param, l_param);
210 return false;
211 } else if (message == metro_get_current_tab_info_message) {
212 GetMetroCurrentTabInfo(w_param);
213 return false;
214 }
215
202 switch (message) { 216 switch (message) {
217 case WM_ACTIVATE:
218 if (LOWORD(w_param) != WA_INACTIVE)
219 CacheMinimizeButtonDelta();
220 return false;
221 case WM_PRINT:
222 if (base::win::IsMetroProcess()) {
223 // This message is sent by the AnimateWindow API which is used in metro
224 // mode to flip between active chrome windows.
225 RECT client_rect = {0};
226 ::GetClientRect(GetNativeView(), &client_rect);
227 HDC dest_dc = reinterpret_cast<HDC>(w_param);
228 DCHECK(dest_dc);
229 HDC src_dc = ::GetDC(GetNativeView());
230 ::BitBlt(dest_dc, 0, 0, client_rect.right - client_rect.left,
231 client_rect.bottom - client_rect.top, src_dc, 0, 0,
232 SRCCOPY);
233 ::ReleaseDC(GetNativeView(), src_dc);
234 *result = 0;
235 return true;
236 }
237 return false;
203 case WM_ENDSESSION: 238 case WM_ENDSESSION:
204 browser::SessionEnding(); 239 browser::SessionEnding();
205 return true; 240 return true;
206 case WM_INITMENUPOPUP: 241 case WM_INITMENUPOPUP:
207 system_menu_->UpdateStates(); 242 system_menu_->UpdateStates();
208 return true; 243 return true;
209 case WM_ACTIVATE:
210 if (LOWORD(w_param) != WA_INACTIVE)
211 CacheMinimizeButtonDelta();
212 return false;
213 } 244 }
214 return false; 245 return false;
215 } 246 }
216 247
217 void BrowserFrameWin::PostHandleMSG(UINT message, 248 void BrowserFrameWin::PostHandleMSG(UINT message,
218 WPARAM w_param, 249 WPARAM w_param,
219 LPARAM l_param) { 250 LPARAM l_param) {
220 switch (message) { 251 switch (message) {
221 case WM_WINDOWPOSCHANGED: 252 case WM_WINDOWPOSCHANGED:
222 UpdateDWMFrame(); 253 UpdateDWMFrame();
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 if (!metro) 405 if (!metro)
375 return; 406 return;
376 // Tell the metro_driver to flip our window. This causes the current 407 // Tell the metro_driver to flip our window. This causes the current
377 // browser window to be hidden and the next window to be shown. 408 // browser window to be hidden and the next window to be shown.
378 static FlipFrameWindows flip_window_fn = reinterpret_cast<FlipFrameWindows>( 409 static FlipFrameWindows flip_window_fn = reinterpret_cast<FlipFrameWindows>(
379 ::GetProcAddress(metro, "FlipFrameWindows")); 410 ::GetProcAddress(metro, "FlipFrameWindows"));
380 if (flip_window_fn) 411 if (flip_window_fn)
381 flip_window_fn(); 412 flip_window_fn();
382 } 413 }
383 414
384 LRESULT BrowserFrameWin::OnWndProc(UINT message,
385 WPARAM w_param,
386 LPARAM l_param) {
387 static const UINT metro_navigation_search_message =
388 RegisterWindowMessage(chrome::kMetroNavigationAndSearchMessage);
389
390 static const UINT metro_get_current_tab_info_message =
391 RegisterWindowMessage(chrome::kMetroGetCurrentTabInfoMessage);
392
393 if (message == metro_navigation_search_message) {
394 HandleMetroNavSearchRequest(w_param, l_param);
395 } else if (message == metro_get_current_tab_info_message) {
396 GetMetroCurrentTabInfo(w_param);
397 } else if (message == WM_PRINT && base::win::IsMetroProcess()) {
398 // This message is sent by the AnimateWindow API which is used in metro
399 // mode to flip between active chrome windows.
400 RECT client_rect = {0};
401 ::GetClientRect(GetNativeView(), &client_rect);
402 HDC dest_dc = reinterpret_cast<HDC>(w_param);
403 DCHECK(dest_dc);
404 HDC src_dc = ::GetDC(GetNativeView());
405 ::BitBlt(dest_dc, 0, 0, client_rect.right - client_rect.left,
406 client_rect.bottom - client_rect.top, src_dc, 0, 0,
407 SRCCOPY);
408 ::ReleaseDC(GetNativeView(), src_dc);
409 return 0;
410 }
411 return views::NativeWidgetWin::OnWndProc(message, w_param, l_param);
412 }
413
414 /////////////////////////////////////////////////////////////////////////////// 415 ///////////////////////////////////////////////////////////////////////////////
415 // BrowserFrameWin, private: 416 // BrowserFrameWin, private:
416 417
417 void BrowserFrameWin::UpdateDWMFrame() { 418 void BrowserFrameWin::UpdateDWMFrame() {
418 // For "normal" windows on Aero, we always need to reset the glass area 419 // For "normal" windows on Aero, we always need to reset the glass area
419 // correctly, even if we're not currently showing the native frame (e.g. 420 // correctly, even if we're not currently showing the native frame (e.g.
420 // because a theme is showing), so we explicitly check for that case rather 421 // because a theme is showing), so we explicitly check for that case rather
421 // than checking browser_frame_->ShouldUseNativeFrame() here. Using that here 422 // than checking browser_frame_->ShouldUseNativeFrame() here. Using that here
422 // would mean we wouldn't reset the glass area to zero when moving from the 423 // would mean we wouldn't reset the glass area to zero when moving from the
423 // native frame to an opaque frame, leading to graphical glitches behind the 424 // native frame to an opaque frame, leading to graphical glitches behind the
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
613 614
614 //////////////////////////////////////////////////////////////////////////////// 615 ////////////////////////////////////////////////////////////////////////////////
615 // NativeBrowserFrame, public: 616 // NativeBrowserFrame, public:
616 617
617 // static 618 // static
618 NativeBrowserFrame* NativeBrowserFrame::CreateNativeBrowserFrame( 619 NativeBrowserFrame* NativeBrowserFrame::CreateNativeBrowserFrame(
619 BrowserFrame* browser_frame, 620 BrowserFrame* browser_frame,
620 BrowserView* browser_view) { 621 BrowserView* browser_view) {
621 return new BrowserFrameWin(browser_frame, browser_view); 622 return new BrowserFrameWin(browser_frame, browser_view);
622 } 623 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/frame/browser_frame_win.h ('k') | ui/views/widget/native_widget_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698