summaryrefslogtreecommitdiffstats
path: root/chrome/browser/user_style_sheet_watcher.cc
diff options
context:
space:
mode:
authormnissler@chromium.org <mnissler@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-17 15:04:42 +0000
committermnissler@chromium.org <mnissler@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-17 15:04:42 +0000
commitc369ffd33760e7b2f6aad22b3747dff321bf497a (patch)
tree18a08bfd012b1f17f24f22042e7af4dd2fe541e9 /chrome/browser/user_style_sheet_watcher.cc
parent9d03e7300b24129e53ac5f7894c003336c35f170 (diff)
downloadchromium_src-c369ffd33760e7b2f6aad22b3747dff321bf497a.zip
chromium_src-c369ffd33760e7b2f6aad22b3747dff321bf497a.tar.gz
chromium_src-c369ffd33760e7b2f6aad22b3747dff321bf497a.tar.bz2
Revert 56341 - Add support for watching directories to FileWatcher.
BUG=none TEST=Unit tests in file_watcher_unittest.cc. Review URL: http://codereview.chromium.org/3149004 TBR=mnissler@chromium.org Review URL: http://codereview.chromium.org/3165027 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@56349 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/user_style_sheet_watcher.cc')
-rw-r--r--chrome/browser/user_style_sheet_watcher.cc38
1 files changed, 19 insertions, 19 deletions
diff --git a/chrome/browser/user_style_sheet_watcher.cc b/chrome/browser/user_style_sheet_watcher.cc
index a8789fd..3743820 100644
--- a/chrome/browser/user_style_sheet_watcher.cc
+++ b/chrome/browser/user_style_sheet_watcher.cc
@@ -22,21 +22,21 @@ const char kUserStyleSheetFile[] = "Custom.css";
// file thread and sends a notification when the style sheet is loaded. It is
// a helper to UserStyleSheetWatcher. The reference graph is as follows:
//
-// .-----------------------. owns .-----------------.
-// | UserStyleSheetWatcher |----------->| FilePathWatcher |
-// '-----------------------' '-----------------'
-// | |
-// V |
-// .----------------------. |
-// | UserStyleSheetLoader |<--------------------'
+// .-----------------------. owns .-------------.
+// | UserStyleSheetWatcher |----------->| FileWatcher |
+// '-----------------------' '-------------'
+// | |
+// V |
+// .----------------------. |
+// | UserStyleSheetLoader |<------------------'
// '----------------------'
//
-// FilePathWatcher's reference to UserStyleSheetLoader is used for delivering
-// the change notifications. Since they happen asynchronously,
-// UserStyleSheetWatcher and its FilePathWatcher may be destroyed while a
-// callback to UserStyleSheetLoader is in progress, in which case the
-// UserStyleSheetLoader object outlives the watchers.
-class UserStyleSheetLoader : public FilePathWatcher::Delegate {
+// FileWatcher's reference to UserStyleSheetLoader is used for delivering the
+// change notifications. Since they happen asynchronously, UserStyleSheetWatcher
+// and its FileWatcher may be destroyed while a callback to UserStyleSheetLoader
+// is in progress, in which case the UserStyleSheetLoader object outlives the
+// watchers.
+class UserStyleSheetLoader : public FileWatcher::Delegate {
public:
UserStyleSheetLoader();
virtual ~UserStyleSheetLoader() {}
@@ -52,8 +52,8 @@ class UserStyleSheetLoader : public FilePathWatcher::Delegate {
// Send out a notification if the stylesheet has already been loaded.
void NotifyLoaded();
- // FilePathWatcher::Delegate interface
- virtual void OnFilePathChanged(const FilePath& path);
+ // FileWatcher::Delegate interface
+ virtual void OnFileChanged(const FilePath& path);
private:
// Called on the UI thread after the stylesheet has loaded.
@@ -81,7 +81,7 @@ void UserStyleSheetLoader::NotifyLoaded() {
}
}
-void UserStyleSheetLoader::OnFilePathChanged(const FilePath& path) {
+void UserStyleSheetLoader::OnFileChanged(const FilePath& path) {
LoadStyleSheet(path);
}
@@ -145,11 +145,11 @@ void UserStyleSheetWatcher::Init() {
}
if (!file_watcher_.get()) {
- file_watcher_.reset(new FilePathWatcher);
+ file_watcher_.reset(new FileWatcher);
+ file_watcher_->Watch(profile_path_.AppendASCII(kStyleSheetDir)
+ .AppendASCII(kUserStyleSheetFile), loader_.get());
FilePath style_sheet_file = profile_path_.AppendASCII(kStyleSheetDir)
.AppendASCII(kUserStyleSheetFile);
- if (!file_watcher_->Watch(style_sheet_file, loader_.get()))
- LOG(ERROR) << "Failed to setup watch for " << style_sheet_file.value();
loader_->LoadStyleSheet(style_sheet_file);
}
}