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

Side by Side Diff: chrome/browser/ui/cocoa/panels/panel_stack_window_cocoa.mm

Issue 132203004: Remove window_snapshot.* (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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/cocoa/panels/panel_stack_window_cocoa.h" 5 #include "chrome/browser/ui/cocoa/panels/panel_stack_window_cocoa.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/strings/sys_string_conversions.h" 8 #include "base/strings/sys_string_conversions.h"
9 #import "chrome/browser/ui/cocoa/panels/panel_cocoa.h" 9 #import "chrome/browser/ui/cocoa/panels/panel_cocoa.h"
10 #import "chrome/browser/ui/cocoa/panels/panel_utils_cocoa.h" 10 #import "chrome/browser/ui/cocoa/panels/panel_utils_cocoa.h"
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 iter != bounds_updates_.end(); ++iter) { 283 iter != bounds_updates_.end(); ++iter) {
284 Panel* panel = iter->first; 284 Panel* panel = iter->first;
285 panel->manager()->OnPanelAnimationEnded(panel); 285 panel->manager()->OnPanelAnimationEnded(panel);
286 } 286 }
287 bounds_updates_.clear(); 287 bounds_updates_.clear();
288 288
289 delegate_->PanelBoundsBatchUpdateCompleted(); 289 delegate_->PanelBoundsBatchUpdateCompleted();
290 } 290 }
291 291
292 void PanelStackWindowCocoa::Minimize() { 292 void PanelStackWindowCocoa::Minimize() {
293 if (!g_browser_process->local_state()->GetBoolean(
294 prefs::kDisableScreenshots)) {
295 [window_ miniaturize:nil];
296 return;
297 }
293 // Provide the custom miniwindow image since there is nothing painted for 298 // Provide the custom miniwindow image since there is nothing painted for
294 // the background stack window. 299 // the background stack window.
295 gfx::Size stack_window_size = GetStackWindowBounds().size(); 300 gfx::Size stack_window_size = GetStackWindowBounds().size();
296 gfx::Canvas canvas(stack_window_size, 1.0f, true); 301 gfx::Canvas canvas(stack_window_size, 1.0f, true);
297 int y = 0; 302 int y = 0;
298 Panels::const_iterator iter = panels_.begin(); 303 Panels::const_iterator iter = panels_.begin();
299 for (; iter != panels_.end(); ++iter) { 304 for (; iter != panels_.end(); ++iter) {
300 Panel* panel = *iter; 305 Panel* panel = *iter;
301 gfx::Rect snapshot_bounds = gfx::Rect(panel->GetBounds().size()); 306 gfx::Rect snapshot_bounds = gfx::Rect(panel->GetBounds().size());
302 std::vector<unsigned char> png; 307 std::vector<unsigned char> png;
303 if (!chrome::GrabWindowSnapshotForUser(panel->GetNativeWindow(), 308 if (ui::GrabWindowSnapshot(panel->GetNativeWindow(), &png, snapshot_bounds))
jianli 2014/01/10 00:47:37 Should we break out for loop when the function ret
enne (OOO) 2014/01/10 01:29:38 I don't know this code very well. Breaking out of
304 &png,
305 snapshot_bounds)) {
306 break; 309 break;
307 }
308 gfx::Image snapshot_image = gfx::Image::CreateFrom1xPNGBytes( 310 gfx::Image snapshot_image = gfx::Image::CreateFrom1xPNGBytes(
309 &(png[0]), png.size()); 311 &(png[0]), png.size());
310 canvas.DrawImageInt(snapshot_image.AsImageSkia(), 0, y); 312 canvas.DrawImageInt(snapshot_image.AsImageSkia(), 0, y);
311 y += snapshot_bounds.height(); 313 y += snapshot_bounds.height();
312 } 314 }
313 if (iter == panels_.end()) { 315 if (iter == panels_.end()) {
314 gfx::Image image(gfx::ImageSkia(canvas.ExtractImageRep())); 316 gfx::Image image(gfx::ImageSkia(canvas.ExtractImageRep()));
315 [window_ setMiniwindowImage:image.AsNSImage()]; 317 [window_ setMiniwindowImage:image.AsNSImage()];
316 } 318 }
317 319
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 [[NSWindow alloc] initWithContentRect:ui::kWindowSizeDeterminedLater 374 [[NSWindow alloc] initWithContentRect:ui::kWindowSizeDeterminedLater
373 styleMask:NSBorderlessWindowMask 375 styleMask:NSBorderlessWindowMask
374 backing:NSBackingStoreBuffered 376 backing:NSBackingStoreBuffered
375 defer:NO]); 377 defer:NO]);
376 [window_ setBackgroundColor:[NSColor clearColor]]; 378 [window_ setBackgroundColor:[NSColor clearColor]];
377 [window_ setHasShadow:YES]; 379 [window_ setHasShadow:YES];
378 [window_ setLevel:NSNormalWindowLevel]; 380 [window_ setLevel:NSNormalWindowLevel];
379 [window_ orderFront:nil]; 381 [window_ orderFront:nil];
380 [window_ setTitle:base::SysUTF16ToNSString(delegate_->GetTitle())]; 382 [window_ setTitle:base::SysUTF16ToNSString(delegate_->GetTitle())];
381 } 383 }
OLDNEW
« no previous file with comments | « chrome/browser/prefs/browser_prefs.cc ('k') | chrome/browser/ui/window_snapshot/window_snapshot.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698