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

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

Issue 7327007: Moving notification types which are chrome specific to a new header file chrome_notification_type... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 5 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/file_util.h" 8 #include "base/file_util.h"
9 #include "chrome/common/chrome_notification_types.h"
9 #include "content/common/notification_service.h" 10 #include "content/common/notification_service.h"
10 #include "content/common/notification_type.h" 11 #include "content/common/notification_type.h"
11 12
12 using ::base::files::FilePathWatcher; 13 using ::base::files::FilePathWatcher;
13 14
14 namespace { 15 namespace {
15 16
16 // The subdirectory of the profile that contains the style sheet. 17 // The subdirectory of the profile that contains the style sheet.
17 const char kStyleSheetDir[] = "User StyleSheets"; 18 const char kStyleSheetDir[] = "User StyleSheets";
18 // The filename of the stylesheet. 19 // The filename of the stylesheet.
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 DISALLOW_COPY_AND_ASSIGN(UserStyleSheetLoader); 71 DISALLOW_COPY_AND_ASSIGN(UserStyleSheetLoader);
71 }; 72 };
72 73
73 UserStyleSheetLoader::UserStyleSheetLoader() 74 UserStyleSheetLoader::UserStyleSheetLoader()
74 : has_loaded_(false) { 75 : has_loaded_(false) {
75 } 76 }
76 77
77 void UserStyleSheetLoader::NotifyLoaded() { 78 void UserStyleSheetLoader::NotifyLoaded() {
78 if (has_loaded_) { 79 if (has_loaded_) {
79 NotificationService::current()->Notify( 80 NotificationService::current()->Notify(
80 NotificationType::USER_STYLE_SHEET_UPDATED, 81 chrome::USER_STYLE_SHEET_UPDATED,
81 Source<UserStyleSheetLoader>(this), 82 Source<UserStyleSheetLoader>(this),
82 NotificationService::NoDetails()); 83 NotificationService::NoDetails());
83 } 84 }
84 } 85 }
85 86
86 void UserStyleSheetLoader::OnFilePathChanged(const FilePath& path) { 87 void UserStyleSheetLoader::OnFilePathChanged(const FilePath& path) {
87 LoadStyleSheet(path); 88 LoadStyleSheet(path);
88 } 89 }
89 90
90 void UserStyleSheetLoader::LoadStyleSheet(const FilePath& style_sheet_file) { 91 void UserStyleSheetLoader::LoadStyleSheet(const FilePath& style_sheet_file) {
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 GURL UserStyleSheetWatcher::user_style_sheet() const { 163 GURL UserStyleSheetWatcher::user_style_sheet() const {
163 return loader_->user_style_sheet(); 164 return loader_->user_style_sheet();
164 } 165 }
165 166
166 void UserStyleSheetWatcher::Observe(NotificationType type, 167 void UserStyleSheetWatcher::Observe(NotificationType type,
167 const NotificationSource& source, const NotificationDetails& details) { 168 const NotificationSource& source, const NotificationDetails& details) {
168 DCHECK(type == NotificationType::RENDER_VIEW_HOST_CREATED_FOR_TAB); 169 DCHECK(type == NotificationType::RENDER_VIEW_HOST_CREATED_FOR_TAB);
169 loader_->NotifyLoaded(); 170 loader_->NotifyLoaded();
170 registrar_.RemoveAll(); 171 registrar_.RemoveAll();
171 } 172 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698