diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-01 18:16:56 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-01 18:16:56 +0000 |
commit | bfd04a62ce610d7bb61dbb78811dccbed23589b7 (patch) | |
tree | 70bb228c0f00ba1c12c584efd569daccf96b4026 /chrome/browser/autocomplete | |
parent | a814d863440f0a154a7299f2d8b440f405c7700e (diff) | |
download | chromium_src-bfd04a62ce610d7bb61dbb78811dccbed23589b7.zip chromium_src-bfd04a62ce610d7bb61dbb78811dccbed23589b7.tar.gz chromium_src-bfd04a62ce610d7bb61dbb78811dccbed23589b7.tar.bz2 |
Remove most header file dependencies on the notification type list. It is
really painful to add more types, since lots of headers include the
notification service to derive from the notification observer. This splits that
out, so much less of the project should end up including notification_types.h
---Paths modified but not in any changelist:
Review URL: http://codereview.chromium.org/19744
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@9020 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/autocomplete')
-rw-r--r-- | chrome/browser/autocomplete/autocomplete.cc | 9 | ||||
-rw-r--r-- | chrome/browser/autocomplete/autocomplete_edit.cc | 9 | ||||
-rw-r--r-- | chrome/browser/autocomplete/autocomplete_popup.cc | 22 | ||||
-rw-r--r-- | chrome/browser/autocomplete/autocomplete_unittest.cc | 9 |
4 files changed, 30 insertions, 19 deletions
diff --git a/chrome/browser/autocomplete/autocomplete.cc b/chrome/browser/autocomplete/autocomplete.cc index 3100319..1281813 100644 --- a/chrome/browser/autocomplete/autocomplete.cc +++ b/chrome/browser/autocomplete/autocomplete.cc @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include <algorithm> - #include "chrome/browser/autocomplete/autocomplete.h" +#include <algorithm> + #include "base/string_util.h" #include "chrome/browser/autocomplete/history_url_provider.h" #include "chrome/browser/autocomplete/history_contents_provider.h" @@ -18,6 +18,7 @@ #include "chrome/browser/profile.h" #include "chrome/common/gfx/text_elider.h" #include "chrome/common/l10n_util.h" +#include "chrome/common/notification_service.h" #include "chrome/common/pref_names.h" #include "chrome/common/pref_service.h" #include "googleurl/src/gurl.h" @@ -691,7 +692,7 @@ void AutocompleteController::UpdateLatestResult(bool is_synchronous_pass) { result_.CopyFrom(latest_result_); NotificationService::current()->Notify( - NOTIFY_AUTOCOMPLETE_CONTROLLER_SYNCHRONOUS_MATCHES_AVAILABLE, + NotificationType::AUTOCOMPLETE_CONTROLLER_SYNCHRONOUS_MATCHES_AVAILABLE, Source<AutocompleteController>(this), NotificationService::NoDetails()); } @@ -719,7 +720,7 @@ void AutocompleteController::CommitResult() { result_.CopyFrom(latest_result_); NotificationService::current()->Notify( - NOTIFY_AUTOCOMPLETE_CONTROLLER_RESULT_UPDATED, + NotificationType::AUTOCOMPLETE_CONTROLLER_RESULT_UPDATED, Source<AutocompleteController>(this), NotificationService::NoDetails()); } diff --git a/chrome/browser/autocomplete/autocomplete_edit.cc b/chrome/browser/autocomplete/autocomplete_edit.cc index 4928b16..6dcbc9e 100644 --- a/chrome/browser/autocomplete/autocomplete_edit.cc +++ b/chrome/browser/autocomplete/autocomplete_edit.cc @@ -31,6 +31,7 @@ #include "chrome/common/gfx/chrome_canvas.h" #include "chrome/common/gfx/utils.h" #include "chrome/common/l10n_util.h" +#include "chrome/common/notification_service.h" #include "chrome/common/os_exchange_data.h" #include "chrome/common/win_util.h" #include "googleurl/src/url_util.h" @@ -284,7 +285,7 @@ void AutocompleteEditModel::SendOpenNotification(size_t selected_line, else if (!has_temporary_text_) log->inline_autocompleted_length = inline_autocomplete_text_.length(); NotificationService::current()->Notify( - NOTIFY_OMNIBOX_OPENED_URL, Source<Profile>(profile_), + NotificationType::OMNIBOX_OPENED_URL, Source<Profile>(profile_), Details<AutocompleteLog>(log.get())); } @@ -782,8 +783,10 @@ AutocompleteEditView::AutocompleteEditView( } AutocompleteEditView::~AutocompleteEditView() { - NotificationService::current()->Notify(NOTIFY_AUTOCOMPLETE_EDIT_DESTROYED, - Source<AutocompleteEditView>(this), NotificationService::NoDetails()); + NotificationService::current()->Notify( + NotificationType::AUTOCOMPLETE_EDIT_DESTROYED, + Source<AutocompleteEditView>(this), + NotificationService::NoDetails()); } void AutocompleteEditView::SaveStateToTab(TabContents* tab) { diff --git a/chrome/browser/autocomplete/autocomplete_popup.cc b/chrome/browser/autocomplete/autocomplete_popup.cc index d2437a3..c8c3f79 100644 --- a/chrome/browser/autocomplete/autocomplete_popup.cc +++ b/chrome/browser/autocomplete/autocomplete_popup.cc @@ -18,6 +18,7 @@ #include "chrome/browser/views/location_bar_view.h" #include "chrome/common/gfx/chrome_canvas.h" #include "chrome/common/l10n_util.h" +#include "chrome/common/notification_service.h" #include "chrome/common/resource_bundle.h" #include "third_party/icu38/public/common/unicode/ubidi.h" @@ -662,11 +663,14 @@ AutocompletePopupModel::AutocompletePopupModel( hovered_line_(kNoMatch), selected_line_(kNoMatch), inside_synchronous_query_(false) { - registrar_.Add(this, NOTIFY_AUTOCOMPLETE_CONTROLLER_RESULT_UPDATED, - Source<AutocompleteController>(controller_.get())); - registrar_.Add(this, - NOTIFY_AUTOCOMPLETE_CONTROLLER_SYNCHRONOUS_MATCHES_AVAILABLE, - Source<AutocompleteController>(controller_.get())); + registrar_.Add( + this, + NotificationType::AUTOCOMPLETE_CONTROLLER_RESULT_UPDATED, + Source<AutocompleteController>(controller_.get())); + registrar_.Add( + this, + NotificationType::AUTOCOMPLETE_CONTROLLER_SYNCHRONOUS_MATCHES_AVAILABLE, + Source<AutocompleteController>(controller_.get())); } AutocompletePopupModel::~AutocompletePopupModel() { @@ -880,7 +884,7 @@ void AutocompletePopupModel::Move(int count) { // aren't out of sync. The better fix here is to roll the controller back to // be in sync with what the popup is showing. if (is_open() && !controller_->done()) { - Observe(NOTIFY_AUTOCOMPLETE_CONTROLLER_RESULT_UPDATED, + Observe(NotificationType::AUTOCOMPLETE_CONTROLLER_RESULT_UPDATED, Source<AutocompleteController>(controller_.get()), NotificationService::NoDetails()); } @@ -929,8 +933,8 @@ void AutocompletePopupModel::Observe(NotificationType type, return; const AutocompleteResult& result = controller_->result(); - switch (type) { - case NOTIFY_AUTOCOMPLETE_CONTROLLER_RESULT_UPDATED: { + switch (type.value) { + case NotificationType::AUTOCOMPLETE_CONTROLLER_RESULT_UPDATED: { selected_line_ = (result.default_match() == result.end()) ? kNoMatch : (result.default_match() - result.begin()); // If we're going to trim the window size to no longer include the hovered @@ -943,7 +947,7 @@ void AutocompletePopupModel::Observe(NotificationType type, } // FALL THROUGH - case NOTIFY_AUTOCOMPLETE_CONTROLLER_SYNCHRONOUS_MATCHES_AVAILABLE: { + case NotificationType::AUTOCOMPLETE_CONTROLLER_SYNCHRONOUS_MATCHES_AVAILABLE: { // Update the edit with the possibly new data for this match. // NOTE: This must be done after the code above, so that our internal // state will be consistent when the edit calls back to diff --git a/chrome/browser/autocomplete/autocomplete_unittest.cc b/chrome/browser/autocomplete/autocomplete_unittest.cc index 9127659..7e9800c 100644 --- a/chrome/browser/autocomplete/autocomplete_unittest.cc +++ b/chrome/browser/autocomplete/autocomplete_unittest.cc @@ -7,6 +7,7 @@ #include "base/string_util.h" #include "chrome/browser/autocomplete/autocomplete.h" #include "chrome/common/notification_registrar.h" +#include "chrome/common/notification_service.h" #include "testing/gtest/include/gtest/gtest.h" // identifiers for known autocomplete providers @@ -118,11 +119,13 @@ class AutocompleteProviderTest : public testing::Test, }; void AutocompleteProviderTest::SetUp() { - registrar_.Add(this, NOTIFY_AUTOCOMPLETE_CONTROLLER_RESULT_UPDATED, - NotificationService::AllSources()); registrar_.Add(this, - NOTIFY_AUTOCOMPLETE_CONTROLLER_SYNCHRONOUS_MATCHES_AVAILABLE, + NotificationType::AUTOCOMPLETE_CONTROLLER_RESULT_UPDATED, NotificationService::AllSources()); + registrar_.Add( + this, + NotificationType::AUTOCOMPLETE_CONTROLLER_SYNCHRONOUS_MATCHES_AVAILABLE, + NotificationService::AllSources()); ResetController(false); } |