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

Side by Side Diff: chrome/browser/user_style_sheet_watcher.cc

Issue 10071036: RefCounted types should not have public destructors, chrome/browser/ part 6 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Implementation fixes Created 8 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 | Annotate | Revision Log
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 #include "chrome/browser/user_style_sheet_watcher.h" 5 #include "chrome/browser/user_style_sheet_watcher.h"
6 6
7 #include "base/base64.h" 7 #include "base/base64.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
(...skipping 29 matching lines...) Expand all
40 // '----------------------' 40 // '----------------------'
41 // 41 //
42 // FilePathWatcher's reference to UserStyleSheetLoader is used for delivering 42 // FilePathWatcher's reference to UserStyleSheetLoader is used for delivering
43 // the change notifications. Since they happen asynchronously, 43 // the change notifications. Since they happen asynchronously,
44 // UserStyleSheetWatcher and its FilePathWatcher may be destroyed while a 44 // UserStyleSheetWatcher and its FilePathWatcher may be destroyed while a
45 // callback to UserStyleSheetLoader is in progress, in which case the 45 // callback to UserStyleSheetLoader is in progress, in which case the
46 // UserStyleSheetLoader object outlives the watchers. 46 // UserStyleSheetLoader object outlives the watchers.
47 class UserStyleSheetLoader : public FilePathWatcher::Delegate { 47 class UserStyleSheetLoader : public FilePathWatcher::Delegate {
48 public: 48 public:
49 UserStyleSheetLoader(); 49 UserStyleSheetLoader();
50 virtual ~UserStyleSheetLoader() {}
51 50
52 GURL user_style_sheet() const { 51 GURL user_style_sheet() const {
53 return user_style_sheet_; 52 return user_style_sheet_;
54 } 53 }
55 54
56 // Load the user style sheet on the file thread and convert it to a 55 // Load the user style sheet on the file thread and convert it to a
57 // base64 URL. Posts the base64 URL back to the UI thread. 56 // base64 URL. Posts the base64 URL back to the UI thread.
58 void LoadStyleSheet(const FilePath& style_sheet_file); 57 void LoadStyleSheet(const FilePath& style_sheet_file);
59 58
60 // Send out a notification if the stylesheet has already been loaded. 59 // Send out a notification if the stylesheet has already been loaded.
61 void NotifyLoaded(); 60 void NotifyLoaded();
62 61
63 // FilePathWatcher::Delegate interface 62 // FilePathWatcher::Delegate interface
64 virtual void OnFilePathChanged(const FilePath& path); 63 virtual void OnFilePathChanged(const FilePath& path);
65 64
66 private: 65 private:
66 virtual ~UserStyleSheetLoader() {}
67
67 // Called on the UI thread after the stylesheet has loaded. 68 // Called on the UI thread after the stylesheet has loaded.
68 void SetStyleSheet(const GURL& url); 69 void SetStyleSheet(const GURL& url);
69 70
70 // The user style sheet as a base64 data:// URL. 71 // The user style sheet as a base64 data:// URL.
71 GURL user_style_sheet_; 72 GURL user_style_sheet_;
72 73
73 // Whether the stylesheet has been loaded. 74 // Whether the stylesheet has been loaded.
74 bool has_loaded_; 75 bool has_loaded_;
75 76
76 DISALLOW_COPY_AND_ASSIGN(UserStyleSheetLoader); 77 DISALLOW_COPY_AND_ASSIGN(UserStyleSheetLoader);
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 if (profile_->IsSameProfile(Profile::FromBrowserContext( 181 if (profile_->IsSameProfile(Profile::FromBrowserContext(
181 content::Source<WebContents>(source)->GetBrowserContext()))) { 182 content::Source<WebContents>(source)->GetBrowserContext()))) {
182 loader_->NotifyLoaded(); 183 loader_->NotifyLoaded();
183 registrar_.RemoveAll(); 184 registrar_.RemoveAll();
184 } 185 }
185 } 186 }
186 187
187 void UserStyleSheetWatcher::ShutdownOnUIThread() { 188 void UserStyleSheetWatcher::ShutdownOnUIThread() {
188 registrar_.RemoveAll(); 189 registrar_.RemoveAll();
189 } 190 }
OLDNEW
« no previous file with comments | « chrome/browser/status_icons/desktop_notification_balloon.cc ('k') | chrome/browser/webdata/web_data_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698