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

Side by Side Diff: chrome/browser/chromeos/extensions/wallpaper_private_api.h

Issue 11092078: Add some error messages for setting wallpaper failures on Chrome(c++) side. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: use SetError Created 8 years, 2 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/chromeos/extensions/wallpaper_private_api.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 #ifndef CHROME_BROWSER_CHROMEOS_EXTENSIONS_WALLPAPER_PRIVATE_API_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_EXTENSIONS_WALLPAPER_PRIVATE_API_H_
6 #define CHROME_BROWSER_CHROMEOS_EXTENSIONS_WALLPAPER_PRIVATE_API_H_ 6 #define CHROME_BROWSER_CHROMEOS_EXTENSIONS_WALLPAPER_PRIVATE_API_H_
7 7
8 #include "ash/desktop_background/desktop_background_resources.h" 8 #include "ash/desktop_background/desktop_background_resources.h"
9 #include "chrome/browser/extensions/extension_function.h" 9 #include "chrome/browser/extensions/extension_function.h"
10 #include "net/url_request/url_fetcher_delegate.h" 10 #include "net/url_request/url_fetcher_delegate.h"
(...skipping 19 matching lines...) Expand all
30 30
31 protected: 31 protected:
32 virtual ~WallpaperFunctionBase(); 32 virtual ~WallpaperFunctionBase();
33 33
34 // A class to decode JPEG file. 34 // A class to decode JPEG file.
35 class WallpaperDecoder; 35 class WallpaperDecoder;
36 36
37 // Holds an instance of WallpaperDecoder. 37 // Holds an instance of WallpaperDecoder.
38 static WallpaperDecoder* wallpaper_decoder_; 38 static WallpaperDecoder* wallpaper_decoder_;
39 39
40 // Handles failure or cancel cases. Passes error message to Javascript side.
41 void OnFailureOrCancel(const std::string& error);
42
40 private: 43 private:
41 virtual void OnWallpaperDecoded(const gfx::ImageSkia& wallpaper) = 0; 44 virtual void OnWallpaperDecoded(const gfx::ImageSkia& wallpaper) = 0;
42 virtual void OnFailureOrCancel() = 0;
43 }; 45 };
44 46
45 class WallpaperSetWallpaperFunction : public WallpaperFunctionBase { 47 class WallpaperSetWallpaperFunction : public WallpaperFunctionBase {
46 public: 48 public:
47 DECLARE_EXTENSION_FUNCTION_NAME("wallpaperPrivate.setWallpaper"); 49 DECLARE_EXTENSION_FUNCTION_NAME("wallpaperPrivate.setWallpaper");
48 50
49 WallpaperSetWallpaperFunction(); 51 WallpaperSetWallpaperFunction();
50 52
51 protected: 53 protected:
52 virtual ~WallpaperSetWallpaperFunction(); 54 virtual ~WallpaperSetWallpaperFunction();
53 55
54 // AsyncExtensionFunction overrides. 56 // AsyncExtensionFunction overrides.
55 virtual bool RunImpl() OVERRIDE; 57 virtual bool RunImpl() OVERRIDE;
56 58
57 private: 59 private:
58 virtual void OnWallpaperDecoded(const gfx::ImageSkia& wallpaper) OVERRIDE; 60 virtual void OnWallpaperDecoded(const gfx::ImageSkia& wallpaper) OVERRIDE;
59 virtual void OnFailureOrCancel() OVERRIDE;
60 61
61 // Saves the image data to a file. 62 // Saves the image data to a file.
62 void SaveToFile(); 63 void SaveToFile();
63 64
64 // Sets wallpaper to the decoded image. 65 // Sets wallpaper to the decoded image.
65 void SetDecodedWallpaper(); 66 void SetDecodedWallpaper();
66 67
67 // Layout of the downloaded wallpaper. 68 // Layout of the downloaded wallpaper.
68 ash::WallpaperLayout layout_; 69 ash::WallpaperLayout layout_;
69 70
(...skipping 17 matching lines...) Expand all
87 WallpaperSetCustomWallpaperFunction(); 88 WallpaperSetCustomWallpaperFunction();
88 89
89 protected: 90 protected:
90 virtual ~WallpaperSetCustomWallpaperFunction(); 91 virtual ~WallpaperSetCustomWallpaperFunction();
91 92
92 // AsyncExtensionFunction overrides. 93 // AsyncExtensionFunction overrides.
93 virtual bool RunImpl() OVERRIDE; 94 virtual bool RunImpl() OVERRIDE;
94 95
95 private: 96 private:
96 virtual void OnWallpaperDecoded(const gfx::ImageSkia& wallpaper) OVERRIDE; 97 virtual void OnWallpaperDecoded(const gfx::ImageSkia& wallpaper) OVERRIDE;
97 virtual void OnFailureOrCancel() OVERRIDE;
98 98
99 // Layout of the downloaded wallpaper. 99 // Layout of the downloaded wallpaper.
100 ash::WallpaperLayout layout_; 100 ash::WallpaperLayout layout_;
101 101
102 // Email address of logged in user. 102 // Email address of logged in user.
103 std::string email_; 103 std::string email_;
104 104
105 // String representation of downloaded wallpaper. 105 // String representation of downloaded wallpaper.
106 std::string image_data_; 106 std::string image_data_;
107 }; 107 };
108 108
109 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_WALLPAPER_PRIVATE_API_H_ 109 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_WALLPAPER_PRIVATE_API_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/extensions/wallpaper_private_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698