diff options
Diffstat (limited to 'chrome/browser/user_style_sheet_watcher.cc')
| -rw-r--r-- | chrome/browser/user_style_sheet_watcher.cc | 38 |
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); } } |
