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/ash/screenshot_taker.h

Issue 14027009: Crash when taking screenshot onto Chrome OS Google Drive (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: minor Created 7 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
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 #ifndef CHROME_BROWSER_UI_ASH_SCREENSHOT_TAKER_H_ 5 #ifndef CHROME_BROWSER_UI_ASH_SCREENSHOT_TAKER_H_
6 #define CHROME_BROWSER_UI_ASH_SCREENSHOT_TAKER_H_ 6 #define CHROME_BROWSER_UI_ASH_SCREENSHOT_TAKER_H_
7 7
8 #include "ash/screenshot_delegate.h" 8 #include "ash/screenshot_delegate.h"
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 virtual void OnScreenshotCompleted( 42 virtual void OnScreenshotCompleted(
43 Result screenshot_result, 43 Result screenshot_result,
44 const base::FilePath& screenshot_path) = 0; 44 const base::FilePath& screenshot_path) = 0;
45 45
46 protected: 46 protected:
47 virtual ~ScreenshotTakerObserver() {} 47 virtual ~ScreenshotTakerObserver() {}
48 }; 48 };
49 49
50 class ScreenshotTaker : public ash::ScreenshotDelegate { 50 class ScreenshotTaker : public ash::ScreenshotDelegate {
51 public: 51 public:
52 explicit ScreenshotTaker(Profile* profile); 52 ScreenshotTaker();
53 53
54 virtual ~ScreenshotTaker(); 54 virtual ~ScreenshotTaker();
55 55
56 // Overridden from ash::ScreenshotDelegate: 56 // Overridden from ash::ScreenshotDelegate:
57 virtual void HandleTakeScreenshotForAllRootWindows() OVERRIDE; 57 virtual void HandleTakeScreenshotForAllRootWindows() OVERRIDE;
58 virtual void HandleTakePartialScreenshot(aura::Window* window, 58 virtual void HandleTakePartialScreenshot(aura::Window* window,
59 const gfx::Rect& rect) OVERRIDE; 59 const gfx::Rect& rect) OVERRIDE;
60 virtual bool CanTakeScreenshot() OVERRIDE; 60 virtual bool CanTakeScreenshot() OVERRIDE;
61 61
62 void ShowNotification( 62 void ShowNotification(
63 ScreenshotTakerObserver::Result screenshot_result, 63 ScreenshotTakerObserver::Result screenshot_result,
64 const base::FilePath& screenshot_path); 64 const base::FilePath& screenshot_path);
65 65
66 void AddObserver(ScreenshotTakerObserver* observer); 66 void AddObserver(ScreenshotTakerObserver* observer);
67 void RemoveObserver(ScreenshotTakerObserver* observer); 67 void RemoveObserver(ScreenshotTakerObserver* observer);
68 bool HasObserver(ScreenshotTakerObserver* observer) const; 68 bool HasObserver(ScreenshotTakerObserver* observer) const;
69 69
70 private: 70 private:
71 friend class ash::test::ScreenshotTakerTest; 71 friend class ash::test::ScreenshotTakerTest;
72 72
73 Profile* GetProfile();
73 void SetScreenshotDirectoryForTest(const base::FilePath& directory); 74 void SetScreenshotDirectoryForTest(const base::FilePath& directory);
74 void SetScreenshotBasenameForTest(const std::string& basename); 75 void SetScreenshotBasenameForTest(const std::string& basename);
75 76 void SetScreenshotProfileForTest(Profile* profile);
76 Profile* profile_;
77 77
78 base::WeakPtrFactory<ScreenshotTaker> factory_; 78 base::WeakPtrFactory<ScreenshotTaker> factory_;
79 79
80 // The timestamp when the screenshot task was issued last time. 80 // The timestamp when the screenshot task was issued last time.
81 base::Time last_screenshot_timestamp_; 81 base::Time last_screenshot_timestamp_;
82 82
83 ObserverList<ScreenshotTakerObserver> observers_; 83 ObserverList<ScreenshotTakerObserver> observers_;
84
84 base::FilePath screenshot_directory_for_test_; 85 base::FilePath screenshot_directory_for_test_;
85 std::string screenshot_basename_for_test_; 86 std::string screenshot_basename_for_test_;
87 Profile* profile_for_test_;
86 88
87 DISALLOW_COPY_AND_ASSIGN(ScreenshotTaker); 89 DISALLOW_COPY_AND_ASSIGN(ScreenshotTaker);
88 }; 90 };
89 91
90 #endif // CHROME_BROWSER_UI_ASH_SCREENSHOT_TAKER_H_ 92 #endif // CHROME_BROWSER_UI_ASH_SCREENSHOT_TAKER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698