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

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

Issue 10830158: Refactor GrabWindowSnapshot and GrabWindowSnapshotImpl names to GrabWindowSnapshotForUser and GrabW… (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fixed compiling tests, fixed indent Created 8 years, 4 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 | « no previous file | chrome/browser/ui/webui/feedback_ui.cc » ('j') | 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/ash/screenshot_taker.h" 5 #include "chrome/browser/ui/ash/screenshot_taker.h"
6 6
7 #include <climits> 7 #include <climits>
8 #include <string> 8 #include <string>
9 9
10 #include "ash/shell.h" 10 #include "ash/shell.h"
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 114
115 bool AreScreenshotsDisabled() { 115 bool AreScreenshotsDisabled() {
116 return g_browser_process->local_state()->GetBoolean( 116 return g_browser_process->local_state()->GetBoolean(
117 prefs::kDisableScreenshots); 117 prefs::kDisableScreenshots);
118 } 118 }
119 119
120 bool GrabWindowSnapshot(aura::Window* window, 120 bool GrabWindowSnapshot(aura::Window* window,
121 const gfx::Rect& snapshot_bounds, 121 const gfx::Rect& snapshot_bounds,
122 std::vector<unsigned char>* png_data) { 122 std::vector<unsigned char>* png_data) {
123 #if defined(OS_LINUX) 123 #if defined(OS_LINUX)
124 // browser::GrabWindowSnapshot checks this too, but RootWindow::GrabSnapshot 124 // chrome::GrabWindowSnapshotForUser checks this too, but
125 // does not. The statement below is only to support linux-specific XGetImage 125 // RootWindow::GrabSnapshot does not.
126 // optimization.
127 if (AreScreenshotsDisabled()) 126 if (AreScreenshotsDisabled())
128 return false; 127 return false;
129 128
130 // We use XGetImage() for Linux/ChromeOS for performance reasons. 129 // We use XGetImage() for Linux/ChromeOS for performance reasons.
131 // See crbug.com/119492 130 // See crbug.com/119492
132 // TODO(mukai): remove this when the performance issue has been fixed. 131 // TODO(mukai): remove this when the performance issue has been fixed.
133 if (window->GetRootWindow()->GrabSnapshot(snapshot_bounds, png_data)) 132 if (window->GetRootWindow()->GrabSnapshot(snapshot_bounds, png_data))
134 return true; 133 return true;
135 #endif // OS_LINUX 134 #endif // OS_LINUX
136 135
137 return chrome::GrabWindowSnapshot(window, png_data, snapshot_bounds); 136 return chrome::GrabWindowSnapshotForUser(window, png_data, snapshot_bounds);
138 } 137 }
139 138
140 // How opaque should the layer that we flash onscreen to provide visual 139 // How opaque should the layer that we flash onscreen to provide visual
141 // feedback after the screenshot is taken be? 140 // feedback after the screenshot is taken be?
142 const float kVisualFeedbackLayerOpacity = 0.25f; 141 const float kVisualFeedbackLayerOpacity = 0.25f;
143 142
144 // How long should the visual feedback layer be displayed? 143 // How long should the visual feedback layer be displayed?
145 const int64 kVisualFeedbackLayerDisplayTimeMs = 100; 144 const int64 kVisualFeedbackLayerDisplayTimeMs = 100;
146 145
147 } // namespace 146 } // namespace
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 ash::internal::kShellWindowId_OverlayContainer)->layer(); 217 ash::internal::kShellWindowId_OverlayContainer)->layer();
219 parent->Add(visual_feedback_layer_.get()); 218 parent->Add(visual_feedback_layer_.get());
220 visual_feedback_layer_->SetVisible(true); 219 visual_feedback_layer_->SetVisible(true);
221 220
222 MessageLoopForUI::current()->PostDelayedTask( 221 MessageLoopForUI::current()->PostDelayedTask(
223 FROM_HERE, 222 FROM_HERE,
224 base::Bind(&ScreenshotTaker::CloseVisualFeedbackLayer, 223 base::Bind(&ScreenshotTaker::CloseVisualFeedbackLayer,
225 base::Unretained(this)), 224 base::Unretained(this)),
226 base::TimeDelta::FromMilliseconds(kVisualFeedbackLayerDisplayTimeMs)); 225 base::TimeDelta::FromMilliseconds(kVisualFeedbackLayerDisplayTimeMs));
227 } 226 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/webui/feedback_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698