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

Side by Side Diff: ui/views/win/hwnd_message_handler.cc

Issue 123793002: Fix omnibox height when less than 64 pixels tall. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 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
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 "ui/views/win/hwnd_message_handler.h" 5 #include "ui/views/win/hwnd_message_handler.h"
6 6
7 #include <dwmapi.h> 7 #include <dwmapi.h>
8 #include <shellapi.h> 8 #include <shellapi.h>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after
473 // If we're in fullscreen mode, we've changed the normal bounds to the monitor 473 // If we're in fullscreen mode, we've changed the normal bounds to the monitor
474 // rect, so return the saved bounds instead. 474 // rect, so return the saved bounds instead.
475 if (fullscreen_handler_->fullscreen()) 475 if (fullscreen_handler_->fullscreen())
476 return fullscreen_handler_->GetRestoreBounds(); 476 return fullscreen_handler_->GetRestoreBounds();
477 477
478 gfx::Rect bounds; 478 gfx::Rect bounds;
479 GetWindowPlacement(&bounds, NULL); 479 GetWindowPlacement(&bounds, NULL);
480 return bounds; 480 return bounds;
481 } 481 }
482 482
483 gfx::Rect HWNDMessageHandler::GetClientAreaBounds() const {
484 if (IsMinimized())
485 return gfx::Rect();
486 if (delegate_->WidgetSizeIsClientSize())
487 return GetClientAreaBoundsInScreen();
488 else
489 return GetWindowBoundsInScreen();
Ben Goodger (Google) 2014/01/09 23:00:07 nit: no else after return
490 }
491
483 void HWNDMessageHandler::GetWindowPlacement( 492 void HWNDMessageHandler::GetWindowPlacement(
484 gfx::Rect* bounds, 493 gfx::Rect* bounds,
485 ui::WindowShowState* show_state) const { 494 ui::WindowShowState* show_state) const {
486 WINDOWPLACEMENT wp; 495 WINDOWPLACEMENT wp;
487 wp.length = sizeof(wp); 496 wp.length = sizeof(wp);
488 const bool succeeded = !!::GetWindowPlacement(hwnd(), &wp); 497 const bool succeeded = !!::GetWindowPlacement(hwnd(), &wp);
489 DCHECK(succeeded); 498 DCHECK(succeeded);
490 499
491 if (bounds != NULL) { 500 if (bounds != NULL) {
492 if (wp.showCmd == SW_SHOWNORMAL) { 501 if (wp.showCmd == SW_SHOWNORMAL) {
(...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after
1047 tme.hwndTrack = hwnd(); 1056 tme.hwndTrack = hwnd();
1048 tme.dwHoverTime = 0; 1057 tme.dwHoverTime = 0;
1049 TrackMouseEvent(&tme); 1058 TrackMouseEvent(&tme);
1050 } else if (mouse_tracking_flags != active_mouse_tracking_flags_) { 1059 } else if (mouse_tracking_flags != active_mouse_tracking_flags_) {
1051 TrackMouseEvents(active_mouse_tracking_flags_ | TME_CANCEL); 1060 TrackMouseEvents(active_mouse_tracking_flags_ | TME_CANCEL);
1052 TrackMouseEvents(mouse_tracking_flags); 1061 TrackMouseEvents(mouse_tracking_flags);
1053 } 1062 }
1054 } 1063 }
1055 1064
1056 void HWNDMessageHandler::ClientAreaSizeChanged() { 1065 void HWNDMessageHandler::ClientAreaSizeChanged() {
1057 RECT r = {0, 0, 0, 0}; 1066 gfx::Size s = GetClientAreaBounds().size();
1058 // In case of minimized window GetWindowRect can return normally unexpected
1059 // coordinates.
1060 if (!IsMinimized()) {
1061 if (delegate_->WidgetSizeIsClientSize())
1062 GetClientRect(hwnd(), &r);
1063 else
1064 GetWindowRect(hwnd(), &r);
1065 }
1066 gfx::Size s(std::max(0, static_cast<int>(r.right - r.left)),
1067 std::max(0, static_cast<int>(r.bottom - r.top)));
1068 delegate_->HandleClientSizeChanged(s); 1067 delegate_->HandleClientSizeChanged(s);
1069 if (use_layered_buffer_) 1068 if (use_layered_buffer_)
1070 layered_window_contents_.reset(new gfx::Canvas(s, 1.0f, false)); 1069 layered_window_contents_.reset(new gfx::Canvas(s, 1.0f, false));
1071 } 1070 }
1072 1071
1073 bool HWNDMessageHandler::GetClientAreaInsets(gfx::Insets* insets) const { 1072 bool HWNDMessageHandler::GetClientAreaInsets(gfx::Insets* insets) const {
1074 if (delegate_->GetClientAreaInsets(insets)) 1073 if (delegate_->GetClientAreaInsets(insets))
1075 return true; 1074 return true;
1076 DCHECK(insets->empty()); 1075 DCHECK(insets->empty());
1077 1076
(...skipping 1177 matching lines...) Expand 10 before | Expand all | Expand 10 after
2255 SetMsgHandled(FALSE); 2254 SetMsgHandled(FALSE);
2256 } 2255 }
2257 2256
2258 void HWNDMessageHandler::HandleTouchEvents(const TouchEvents& touch_events) { 2257 void HWNDMessageHandler::HandleTouchEvents(const TouchEvents& touch_events) {
2259 base::WeakPtr<HWNDMessageHandler> ref(weak_factory_.GetWeakPtr()); 2258 base::WeakPtr<HWNDMessageHandler> ref(weak_factory_.GetWeakPtr());
2260 for (size_t i = 0; i < touch_events.size() && ref; ++i) 2259 for (size_t i = 0; i < touch_events.size() && ref; ++i)
2261 delegate_->HandleTouchEvent(touch_events[i]); 2260 delegate_->HandleTouchEvent(touch_events[i]);
2262 } 2261 }
2263 2262
2264 } // namespace views 2263 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698