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

Side by Side Diff: chrome/browser/ui/views/panels/panel_frame_view.cc

Issue 1406403007: Eliminate HICON leaks caused by creating icons from bitmap image. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use ScopedHICON instead of HICON. Created 5 years, 1 month 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
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/panels/panel_frame_view.h" 5 #include "chrome/browser/ui/views/panels/panel_frame_view.h"
6 6
7 #include "chrome/browser/ui/panels/panel.h" 7 #include "chrome/browser/ui/panels/panel.h"
8 #include "chrome/browser/ui/panels/panel_constants.h" 8 #include "chrome/browser/ui/panels/panel_constants.h"
9 #include "chrome/browser/ui/views/panels/panel_view.h" 9 #include "chrome/browser/ui/views/panels/panel_view.h"
10 #include "chrome/browser/ui/views/tab_icon_view.h" 10 #include "chrome/browser/ui/views/tab_icon_view.h"
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 } 350 }
351 351
352 void PanelFrameView::SetWindowCornerStyle(panel::CornerStyle corner_style) { 352 void PanelFrameView::SetWindowCornerStyle(panel::CornerStyle corner_style) {
353 corner_style_ = corner_style; 353 corner_style_ = corner_style;
354 354
355 #if defined(OS_WIN) 355 #if defined(OS_WIN)
356 // Changing the window region is going to force a paint. Only change the 356 // Changing the window region is going to force a paint. Only change the
357 // window region if the region really differs. 357 // window region if the region really differs.
358 HWND native_window = views::HWNDForWidget(panel_view_->window()); 358 HWND native_window = views::HWNDForWidget(panel_view_->window());
359 base::win::ScopedRegion current_region(::CreateRectRgn(0, 0, 0, 0)); 359 base::win::ScopedRegion current_region(::CreateRectRgn(0, 0, 0, 0));
360 ::GetWindowRgn(native_window, current_region); 360 ::GetWindowRgn(native_window, current_region.get());
361 361
362 gfx::Path window_mask; 362 gfx::Path window_mask;
363 GetWindowMask(size(), &window_mask); 363 GetWindowMask(size(), &window_mask);
364 base::win::ScopedRegion new_region; 364 base::win::ScopedRegion new_region;
365 if (!window_mask.isEmpty()) 365 if (!window_mask.isEmpty())
366 new_region.Set(gfx::CreateHRGNFromSkPath(window_mask)); 366 new_region.reset(gfx::CreateHRGNFromSkPath(window_mask));
367 367
368 const bool has_current_region = current_region != NULL; 368 const bool has_current_region = current_region != NULL;
369 const bool has_new_region = new_region != NULL; 369 const bool has_new_region = new_region != NULL;
370 if (has_current_region != has_new_region || 370 if (has_current_region != has_new_region ||
371 (has_current_region && !::EqualRgn(current_region, new_region))) { 371 (has_current_region &&
372 !::EqualRgn(current_region.get(), new_region.get()))) {
372 // SetWindowRgn takes ownership of the new_region. 373 // SetWindowRgn takes ownership of the new_region.
373 ::SetWindowRgn(native_window, new_region.release(), TRUE); 374 ::SetWindowRgn(native_window, new_region.release(), TRUE);
374 } 375 }
375 #endif 376 #endif
376 } 377 }
377 378
378 gfx::Rect PanelFrameView::GetBoundsForClientView() const { 379 gfx::Rect PanelFrameView::GetBoundsForClientView() const {
379 // The origin of client-area bounds starts after left border and titlebar and 380 // The origin of client-area bounds starts after left border and titlebar and
380 // spans until hitting the right and bottom borders. 381 // spans until hitting the right and bottom borders.
381 // +------------------------------+ 382 // +------------------------------+
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
780 #endif 781 #endif
781 } 782 }
782 783
783 bool PanelFrameView::IsWithinResizingArea( 784 bool PanelFrameView::IsWithinResizingArea(
784 const gfx::Point& mouse_location) const { 785 const gfx::Point& mouse_location) const {
785 panel::Resizability resizability = panel_view_->panel()->CanResizeByMouse(); 786 panel::Resizability resizability = panel_view_->panel()->CanResizeByMouse();
786 int edge_hittest = GetFrameEdgeHitTest( 787 int edge_hittest = GetFrameEdgeHitTest(
787 mouse_location, size(), PanelView::kResizeInsideBoundsSize, resizability); 788 mouse_location, size(), PanelView::kResizeInsideBoundsSize, resizability);
788 return edge_hittest != HTNOWHERE; 789 return edge_hittest != HTNOWHERE;
789 } 790 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698