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

Side by Side Diff: chrome/browser/ui/webui/options/media_galleries_handler.h

Issue 14556015: [Media Galleries] Lazily initialize the storage monitor. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Weak ptr for registry Created 7 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
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_WEBUI_OPTIONS_MEDIA_GALLERIES_HANDLER_H_ 5 #ifndef CHROME_BROWSER_UI_WEBUI_OPTIONS_MEDIA_GALLERIES_HANDLER_H_
6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_MEDIA_GALLERIES_HANDLER_H_ 6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_MEDIA_GALLERIES_HANDLER_H_
7 7
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "base/memory/weak_ptr.h"
9 #include "base/prefs/pref_change_registrar.h" 10 #include "base/prefs/pref_change_registrar.h"
10 #include "chrome/browser/ui/webui/options/options_ui.h" 11 #include "chrome/browser/ui/webui/options/options_ui.h"
11 #include "content/public/browser/notification_observer.h" 12 #include "content/public/browser/notification_observer.h"
12 #include "ui/shell_dialogs/select_file_dialog.h" 13 #include "ui/shell_dialogs/select_file_dialog.h"
13 14
15 namespace chrome {
16 class MediaGalleriesPreferences;
17 }
18
14 namespace options { 19 namespace options {
15 20
16 // Handles messages related to adding or removing media galleries. 21 // Handles messages related to adding or removing media galleries.
17 class MediaGalleriesHandler : public OptionsPageUIHandler, 22 class MediaGalleriesHandler : public OptionsPageUIHandler,
18 public ui::SelectFileDialog::Listener { 23 public ui::SelectFileDialog::Listener {
19 public: 24 public:
20 MediaGalleriesHandler(); 25 MediaGalleriesHandler();
21 virtual ~MediaGalleriesHandler(); 26 virtual ~MediaGalleriesHandler();
22 27
23 // OptionsPageUIHandler implementation. 28 // OptionsPageUIHandler implementation.
24 virtual void GetLocalizedValues(base::DictionaryValue* values) OVERRIDE; 29 virtual void GetLocalizedValues(base::DictionaryValue* values) OVERRIDE;
25 virtual void InitializePage() OVERRIDE; 30 virtual void InitializePage() OVERRIDE;
26 virtual void RegisterMessages() OVERRIDE; 31 virtual void RegisterMessages() OVERRIDE;
27 32
28 // SelectFileDialog::Listener implementation. 33 // SelectFileDialog::Listener implementation.
29 virtual void FileSelected(const base::FilePath& path, 34 virtual void FileSelected(const base::FilePath& path,
30 int index, 35 int index,
31 void* params) OVERRIDE; 36 void* params) OVERRIDE;
32 37
33 private: 38 private:
34 // Handles the "addNewGallery" message (no arguments). 39 // Handles the "addNewGallery" message (no arguments).
35 void HandleAddNewGallery(const base::ListValue* args); 40 void HandleAddNewGallery(const base::ListValue* args);
36 // Handles "forgetGallery" message. The first and only argument is the id of 41 // Handles "forgetGallery" message. The first and only argument is the id of
37 // the gallery. 42 // the gallery.
38 void HandleForgetGallery(const base::ListValue* args); 43 void HandleForgetGallery(const base::ListValue* args);
44 void HandleForgetGalleryWithPreferences(
Lei Zhang 2013/05/14 04:12:23 Can you comment FooWithPreferences() as the second
Greg Billock 2013/05/14 21:27:13 Done.
45 uint64 id,
46 chrome::MediaGalleriesPreferences* preferences);
39 47
40 // Called when the list of known galleries has changed; updates the page. 48 // Called when the list of known galleries has changed; updates the page.
41 void OnGalleriesChanged(); 49 void OnGalleriesChanged();
42 50
51 void OnGalleriesChangedWithPreferences(
52 chrome::MediaGalleriesPreferences* preferences);
53
54 void FileSelectedWithPreferences(
55 base::FilePath path,
56 chrome::MediaGalleriesPreferences* preferences);
57
43 PrefChangeRegistrar pref_change_registrar_; 58 PrefChangeRegistrar pref_change_registrar_;
44 59
45 scoped_refptr<ui::SelectFileDialog> select_file_dialog_; 60 scoped_refptr<ui::SelectFileDialog> select_file_dialog_;
46 61
62 base::WeakPtrFactory<MediaGalleriesHandler> weak_ptr_factory_;
63
47 DISALLOW_COPY_AND_ASSIGN(MediaGalleriesHandler); 64 DISALLOW_COPY_AND_ASSIGN(MediaGalleriesHandler);
48 }; 65 };
49 66
50 } // namespace options 67 } // namespace options
51 68
52 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_MEDIA_GALLERIES_HANDLER_H_ 69 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_MEDIA_GALLERIES_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698