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

Side by Side Diff: chrome/views/window.cc

Issue 42060: Merge r11401.... (Closed) Base URL: svn://chrome-svn.corp.google.com/chrome/branches/169/src/
Patch Set: Created 11 years, 9 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
« no previous file with comments | « chrome/views/window.h ('k') | no next file » | 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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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/views/window.h" 5 #include "chrome/views/window.h"
6 6
7 #include <shellapi.h> 7 #include <shellapi.h>
8 8
9 #include "base/win_util.h" 9 #include "base/win_util.h"
10 #include "chrome/app/chrome_dll_resource.h" 10 #include "chrome/app/chrome_dll_resource.h"
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 owning_hwnd_(NULL), 317 owning_hwnd_(NULL),
318 minimum_size_(100, 100), 318 minimum_size_(100, 100),
319 is_modal_(false), 319 is_modal_(false),
320 restored_enabled_(false), 320 restored_enabled_(false),
321 is_always_on_top_(false), 321 is_always_on_top_(false),
322 window_closed_(false), 322 window_closed_(false),
323 disable_inactive_rendering_(false), 323 disable_inactive_rendering_(false),
324 is_active_(false), 324 is_active_(false),
325 lock_updates_(false), 325 lock_updates_(false),
326 saved_window_style_(0), 326 saved_window_style_(0),
327 saved_maximized_state_(0) { 327 saved_maximized_state_(0),
328 force_hidden_(false) {
328 InitClass(); 329 InitClass();
329 DCHECK(window_delegate_); 330 DCHECK(window_delegate_);
330 window_delegate_->window_.reset(this); 331 window_delegate_->window_.reset(this);
331 // Initialize these values to 0 so that subclasses can override the default 332 // Initialize these values to 0 so that subclasses can override the default
332 // behavior before calling Init. 333 // behavior before calling Init.
333 set_window_style(0); 334 set_window_style(0);
334 set_window_ex_style(0); 335 set_window_ex_style(0);
335 } 336 }
336 337
337 void Window::Init(HWND parent, const gfx::Rect& bounds) { 338 void Window::Init(HWND parent, const gfx::Rect& bounds) {
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
642 bounds.top - clip_state->y, 643 bounds.top - clip_state->y,
643 bounds.right - clip_state->x, 644 bounds.right - clip_state->x,
644 bounds.bottom - clip_state->y); 645 bounds.bottom - clip_state->y);
645 } 646 }
646 return TRUE; 647 return TRUE;
647 } 648 }
648 } // namespace 649 } // namespace
649 650
650 void Window::OnNCPaint(HRGN rgn) { 651 void Window::OnNCPaint(HRGN rgn) {
651 // We only do non-client painting if we're not using the native frame. 652 // We only do non-client painting if we're not using the native frame.
652 if (non_client_view_->UseNativeFrame()) 653 if (non_client_view_->UseNativeFrame()) {
653 return WidgetWin::OnNCPaint(rgn); 654 WidgetWin::OnNCPaint(rgn);
655 return;
656 }
654 657
655 // We have an NC region and need to paint it. We expand the NC region to 658 // We have an NC region and need to paint it. We expand the NC region to
656 // include the dirty region of the root view. This is done to minimize 659 // include the dirty region of the root view. This is done to minimize
657 // paints. 660 // paints.
658 CRect window_rect; 661 CRect window_rect;
659 GetWindowRect(&window_rect); 662 GetWindowRect(&window_rect);
660 663
661 if (window_rect.Width() != root_view_->width() || 664 if (window_rect.Width() != root_view_->width() ||
662 window_rect.Height() != root_view_->height()) { 665 window_rect.Height() != root_view_->height()) {
663 // If the size of the window differs from the size of the root view it 666 // If the size of the window differs from the size of the root view it
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
909 } else if ((notification_code == SC_KEYMENU) && (click.x == VK_SPACE)) { 912 } else if ((notification_code == SC_KEYMENU) && (click.x == VK_SPACE)) {
910 // Run the system menu at the NonClientView's desired location. 913 // Run the system menu at the NonClientView's desired location.
911 RunSystemMenu(non_client_view_->GetSystemMenuPoint()); 914 RunSystemMenu(non_client_view_->GetSystemMenuPoint());
912 } else { 915 } else {
913 // Use the default implementation for any other command. 916 // Use the default implementation for any other command.
914 DefWindowProc(GetHWND(), WM_SYSCOMMAND, notification_code, 917 DefWindowProc(GetHWND(), WM_SYSCOMMAND, notification_code,
915 MAKELPARAM(click.y, click.x)); 918 MAKELPARAM(click.y, click.x));
916 } 919 }
917 } 920 }
918 921
922 void Window::OnWindowPosChanging(WINDOWPOS* window_pos) {
923 if (force_hidden_) {
924 // Prevent the window from being made visible if we've been asked to do so.
925 // See comment in header as to why we might want this.
926 window_pos->flags &= ~SWP_SHOWWINDOW;
927 }
928 WidgetWin::OnWindowPosChanging(window_pos);
929 }
930
919 //////////////////////////////////////////////////////////////////////////////// 931 ////////////////////////////////////////////////////////////////////////////////
920 // Window, private: 932 // Window, private:
921 933
922 void Window::BecomeModal() { 934 void Window::BecomeModal() {
923 // We implement modality by crawling up the hierarchy of windows starting 935 // We implement modality by crawling up the hierarchy of windows starting
924 // at the owner, disabling all of them so that they don't receive input 936 // at the owner, disabling all of them so that they don't receive input
925 // messages. 937 // messages.
926 DCHECK(owning_hwnd_) << "Can't create a modal dialog without an owner"; 938 DCHECK(owning_hwnd_) << "Can't create a modal dialog without an owner";
927 HWND start = owning_hwnd_; 939 HWND start = owning_hwnd_;
928 while (start != NULL) { 940 while (start != NULL) {
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
1172 resize_cursors_[RC_VERTICAL] = LoadCursor(NULL, IDC_SIZENS); 1184 resize_cursors_[RC_VERTICAL] = LoadCursor(NULL, IDC_SIZENS);
1173 resize_cursors_[RC_HORIZONTAL] = LoadCursor(NULL, IDC_SIZEWE); 1185 resize_cursors_[RC_HORIZONTAL] = LoadCursor(NULL, IDC_SIZEWE);
1174 resize_cursors_[RC_NESW] = LoadCursor(NULL, IDC_SIZENESW); 1186 resize_cursors_[RC_NESW] = LoadCursor(NULL, IDC_SIZENESW);
1175 resize_cursors_[RC_NWSE] = LoadCursor(NULL, IDC_SIZENWSE); 1187 resize_cursors_[RC_NWSE] = LoadCursor(NULL, IDC_SIZENWSE);
1176 initialized = true; 1188 initialized = true;
1177 } 1189 }
1178 } 1190 }
1179 1191
1180 } // namespace views 1192 } // namespace views
1181 1193
OLDNEW
« no previous file with comments | « chrome/views/window.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698