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

Side by Side Diff: chrome/browser/ui/views/ash/screenshot_taker.cc

Issue 9854012: Close the screenshot flash effect before the screenshot task is actually executed. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix comment Created 8 years, 8 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 | « no previous file | 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) 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/ash/screenshot_taker.h" 5 #include "chrome/browser/ui/views/ash/screenshot_taker.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "ash/shell.h" 9 #include "ash/shell.h"
10 #include "ash/shell_window_ids.h" 10 #include "ash/shell_window_ids.h"
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 rect, 110 rect,
111 base::Bind(&TakeScreenshot, base::Unretained(window), rect)); 111 base::Bind(&TakeScreenshot, base::Unretained(window), rect));
112 } 112 }
113 113
114 void ScreenshotTaker::HandleTakeScreenshot(aura::Window* window) { 114 void ScreenshotTaker::HandleTakeScreenshot(aura::Window* window) {
115 HandleTakePartialScreenshot(window, window->bounds()); 115 HandleTakePartialScreenshot(window, window->bounds());
116 } 116 }
117 117
118 void ScreenshotTaker::CloseVisualFeedbackLayer(const base::Closure& task) { 118 void ScreenshotTaker::CloseVisualFeedbackLayer(const base::Closure& task) {
119 visual_feedback_layer_.reset(); 119 visual_feedback_layer_.reset();
120 task.Run(); 120 // We want to make the close of visual effect without waiting for the end of
Daniel Erat 2012/03/26 14:49:15 nit: "Hide the visual feedback immediately because
Jun Mukai 2012/03/26 15:09:31 Done.
121 // |task| because it may take long time.
122 MessageLoopForUI::current()->PostTask(FROM_HERE, task);
121 } 123 }
122 124
123 void ScreenshotTaker::DisplayVisualFeedback(const gfx::Rect& rect, 125 void ScreenshotTaker::DisplayVisualFeedback(const gfx::Rect& rect,
124 const base::Closure& task) { 126 const base::Closure& task) {
125 visual_feedback_layer_.reset(new ui::Layer(ui::LAYER_SOLID_COLOR)); 127 visual_feedback_layer_.reset(new ui::Layer(ui::LAYER_SOLID_COLOR));
126 visual_feedback_layer_->SetColor(SK_ColorWHITE); 128 visual_feedback_layer_->SetColor(SK_ColorWHITE);
127 visual_feedback_layer_->SetOpacity(kVisualFeedbackLayerOpacity); 129 visual_feedback_layer_->SetOpacity(kVisualFeedbackLayerOpacity);
128 visual_feedback_layer_->SetBounds(rect); 130 visual_feedback_layer_->SetBounds(rect);
129 131
130 ui::Layer* parent = ash::Shell::GetInstance()->GetContainer( 132 ui::Layer* parent = ash::Shell::GetInstance()->GetContainer(
131 ash::internal::kShellWindowId_OverlayContainer)->layer(); 133 ash::internal::kShellWindowId_OverlayContainer)->layer();
132 parent->Add(visual_feedback_layer_.get()); 134 parent->Add(visual_feedback_layer_.get());
133 visual_feedback_layer_->SetVisible(true); 135 visual_feedback_layer_->SetVisible(true);
134 136
135 MessageLoopForUI::current()->PostDelayedTask( 137 MessageLoopForUI::current()->PostDelayedTask(
136 FROM_HERE, 138 FROM_HERE,
137 base::Bind(&ScreenshotTaker::CloseVisualFeedbackLayer, 139 base::Bind(&ScreenshotTaker::CloseVisualFeedbackLayer,
138 base::Unretained(this), 140 base::Unretained(this),
139 task), 141 task),
140 base::TimeDelta::FromMilliseconds(kVisualFeedbackLayerDisplayTimeMs)); 142 base::TimeDelta::FromMilliseconds(kVisualFeedbackLayerDisplayTimeMs));
141 } 143 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698