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

Side by Side Diff: ash/utility/partial_screenshot_controller.cc

Issue 1128933009: Show the cursor if it was hidden when starting partical screenshot. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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 | ash/utility/partial_screenshot_controller_unittest.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "ash/utility/partial_screenshot_controller.h" 5 #include "ash/utility/partial_screenshot_controller.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 8
9 #include "ash/screenshot_delegate.h" 9 #include "ash/screenshot_delegate.h"
10 #include "ash/shell.h" 10 #include "ash/shell.h"
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 class PartialScreenshotController::ScopedCursorSetter { 88 class PartialScreenshotController::ScopedCursorSetter {
89 public: 89 public:
90 ScopedCursorSetter(::wm::CursorManager* cursor_manager, 90 ScopedCursorSetter(::wm::CursorManager* cursor_manager,
91 gfx::NativeCursor cursor) 91 gfx::NativeCursor cursor)
92 : cursor_manager_(nullptr) { 92 : cursor_manager_(nullptr) {
93 if (cursor_manager->IsCursorLocked()) 93 if (cursor_manager->IsCursorLocked())
94 return; 94 return;
95 gfx::NativeCursor original_cursor = cursor_manager->GetCursor(); 95 gfx::NativeCursor original_cursor = cursor_manager->GetCursor();
96 cursor_manager_ = cursor_manager; 96 cursor_manager_ = cursor_manager;
97 cursor_manager_->SetCursor(cursor); 97 cursor_manager_->SetCursor(cursor);
98 bool was_visible = cursor_manager_->IsCursorVisible();
99 if (!was_visible)
100 cursor_manager_->ShowCursor();
98 cursor_manager_->LockCursor(); 101 cursor_manager_->LockCursor();
99 // SetCursor does not make any effects at this point but it sets back to the 102 // SetCursor/HideCursor do not make any effects at this point
100 // original cursor when unlocked. 103 // but it sets back to the original cursor state when unlocked.
101 cursor_manager_->SetCursor(original_cursor); 104 cursor_manager_->SetCursor(original_cursor);
105 if (!was_visible)
106 cursor_manager_->HideCursor();
Jun Mukai 2015/05/14 22:49:10 Does it have to hide the cursor again? When cursor
oshima 2015/05/14 23:15:55 I was thinking "shift-ctrl-f5 then esc" scenario,
102 } 107 }
103 108
104 ~ScopedCursorSetter() { 109 ~ScopedCursorSetter() {
105 if (cursor_manager_) 110 if (cursor_manager_)
106 cursor_manager_->UnlockCursor(); 111 cursor_manager_->UnlockCursor();
107 } 112 }
108 113
109 private: 114 private:
110 ::wm::CursorManager* cursor_manager_; 115 ::wm::CursorManager* cursor_manager_;
111 116
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 return; 261 return;
257 Cancel(); 262 Cancel();
258 } 263 }
259 264
260 void PartialScreenshotController::OnDisplayMetricsChanged( 265 void PartialScreenshotController::OnDisplayMetricsChanged(
261 const gfx::Display& display, 266 const gfx::Display& display,
262 uint32_t changed_metrics) { 267 uint32_t changed_metrics) {
263 } 268 }
264 269
265 } // namespace ash 270 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/utility/partial_screenshot_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698