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

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

Issue 2234203002: Auto open and close the palette on an eject event. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@tool-note
Patch Set: Initial upload Created 4 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/palette_delegate_chromeos.h" 5 #include "chrome/browser/ui/ash/palette_delegate_chromeos.h"
6 6
7 #include "ash/accelerators/accelerator_controller_delegate_aura.h" 7 #include "ash/accelerators/accelerator_controller_delegate_aura.h"
8 #include "ash/screenshot_delegate.h" 8 #include "ash/screenshot_delegate.h"
9 #include "ash/shell.h" 9 #include "ash/shell.h"
10 #include "ash/utility/screenshot_controller.h" 10 #include "ash/utility/screenshot_controller.h"
11 #include "chrome/browser/chromeos/note_taking_app_utils.h" 11 #include "chrome/browser/chromeos/note_taking_app_utils.h"
12 #include "chrome/browser/profiles/profile_manager.h" 12 #include "chrome/browser/profiles/profile_manager.h"
13 #include "chrome/common/pref_names.h"
14 #include "components/prefs/pref_service.h"
13 15
14 namespace chromeos { 16 namespace chromeos {
15 namespace { 17 namespace {
16 18
17 Profile* GetProfile() { 19 Profile* GetProfile() {
18 return ProfileManager::GetActiveUserProfile(); 20 return ProfileManager::GetActiveUserProfile();
19 } 21 }
20 22
21 } // namespace 23 } // namespace
22 24
23 PaletteDelegateChromeOS::PaletteDelegateChromeOS() {} 25 PaletteDelegateChromeOS::PaletteDelegateChromeOS() {}
24 26
25 PaletteDelegateChromeOS::~PaletteDelegateChromeOS() {} 27 PaletteDelegateChromeOS::~PaletteDelegateChromeOS() {}
26 28
27 void PaletteDelegateChromeOS::CreateNote() { 29 void PaletteDelegateChromeOS::CreateNote() {
28 chromeos::LaunchNoteTakingAppForNewNote(GetProfile(), base::FilePath()); 30 chromeos::LaunchNoteTakingAppForNewNote(GetProfile(), base::FilePath());
29 } 31 }
30 32
31 bool PaletteDelegateChromeOS::HasNoteApp() { 33 bool PaletteDelegateChromeOS::HasNoteApp() {
32 return chromeos::IsNoteTakingAppAvailable(GetProfile()); 34 return chromeos::IsNoteTakingAppAvailable(GetProfile());
33 } 35 }
34 36
37 bool PaletteDelegateChromeOS::ShouldAutoOpenPalette() {
38 return GetProfile()->GetPrefs()->GetBoolean(
39 prefs::kLaunchPaletteOnEjectEvent);
40 }
41
35 void PaletteDelegateChromeOS::TakeScreenshot() { 42 void PaletteDelegateChromeOS::TakeScreenshot() {
36 auto screenshot_controller = 43 auto screenshot_controller =
37 ash::Shell::GetInstance()->screenshot_controller(); 44 ash::Shell::GetInstance()->screenshot_controller();
38 auto screenshot_delegate = ash::Shell::GetInstance() 45 auto screenshot_delegate = ash::Shell::GetInstance()
39 ->accelerator_controller_delegate() 46 ->accelerator_controller_delegate()
40 ->screenshot_delegate(); 47 ->screenshot_delegate();
41 48
42 screenshot_controller->StartWindowScreenshotSession(screenshot_delegate); 49 screenshot_controller->StartWindowScreenshotSession(screenshot_delegate);
43 } 50 }
44 51
45 void PaletteDelegateChromeOS::TakePartialScreenshot() { 52 void PaletteDelegateChromeOS::TakePartialScreenshot() {
46 auto screenshot_controller = 53 auto screenshot_controller =
47 ash::Shell::GetInstance()->screenshot_controller(); 54 ash::Shell::GetInstance()->screenshot_controller();
48 auto screenshot_delegate = ash::Shell::GetInstance() 55 auto screenshot_delegate = ash::Shell::GetInstance()
49 ->accelerator_controller_delegate() 56 ->accelerator_controller_delegate()
50 ->screenshot_delegate(); 57 ->screenshot_delegate();
51 58
52 screenshot_controller->set_pointer_only(true); 59 screenshot_controller->set_pointer_only(true);
53 screenshot_controller->StartPartialScreenshotSession(screenshot_delegate, 60 screenshot_controller->StartPartialScreenshotSession(screenshot_delegate,
54 false); 61 false);
55 } 62 }
56 63
57 } // namespace chromeos 64 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698