summaryrefslogtreecommitdiffstats
path: root/chrome/browser/automation
diff options
context:
space:
mode:
authorpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-09-10 19:35:52 +0000
committerpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-09-10 19:35:52 +0000
commit81c2122f16c82b52c19b474775d2a15aa065e77a (patch)
treebeee93270b997c49f83ba0233ac1dd12cebaf3a8 /chrome/browser/automation
parent8fbab00264861b95a99a8232ba75e0994c46c185 (diff)
downloadchromium_src-81c2122f16c82b52c19b474775d2a15aa065e77a.zip
chromium_src-81c2122f16c82b52c19b474775d2a15aa065e77a.tar.gz
chromium_src-81c2122f16c82b52c19b474775d2a15aa065e77a.tar.bz2
First pass at splitting the AutocompleteEdit into Model and View. This was noticeably harder than with the Popup and I'm not at all sure I've made the right decisions :(. The View code is about 3x larger than the model.
BUG=1343512 Review URL: http://codereview.chromium.org/1872 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@2004 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/automation')
-rw-r--r--chrome/browser/automation/automation_autocomplete_edit_tracker.h10
-rw-r--r--chrome/browser/automation/automation_provider.cc25
2 files changed, 15 insertions, 20 deletions
diff --git a/chrome/browser/automation/automation_autocomplete_edit_tracker.h b/chrome/browser/automation/automation_autocomplete_edit_tracker.h
index b750938..81f0ecd 100644
--- a/chrome/browser/automation/automation_autocomplete_edit_tracker.h
+++ b/chrome/browser/automation/automation_autocomplete_edit_tracker.h
@@ -9,7 +9,7 @@
#include "chrome/browser/automation/automation_resource_tracker.h"
class AutomationAutocompleteEditTracker:
- public AutomationResourceTracker<AutocompleteEdit*> {
+ public AutomationResourceTracker<AutocompleteEditView*> {
public:
explicit AutomationAutocompleteEditTracker(IPC::Message::Sender* automation)
: AutomationResourceTracker(automation) { }
@@ -18,16 +18,16 @@ class AutomationAutocompleteEditTracker:
ClearAllMappings();
}
- virtual void AddObserver(AutocompleteEdit* resource) {
+ virtual void AddObserver(AutocompleteEditView* resource) {
NotificationService::current()->AddObserver(
this, NOTIFY_AUTOCOMPLETE_EDIT_DESTROYED,
- Source<AutocompleteEdit>(resource));
+ Source<AutocompleteEditView>(resource));
}
- virtual void RemoveObserver(AutocompleteEdit* resource) {
+ virtual void RemoveObserver(AutocompleteEditView* resource) {
NotificationService::current()->RemoveObserver(
this, NOTIFY_AUTOCOMPLETE_EDIT_DESTROYED,
- Source<AutocompleteEdit>(resource));
+ Source<AutocompleteEditView>(resource));
}
};
diff --git a/chrome/browser/automation/automation_provider.cc b/chrome/browser/automation/automation_provider.cc
index b831a71..a9ae6a8b 100644
--- a/chrome/browser/automation/automation_provider.cc
+++ b/chrome/browser/automation/automation_provider.cc
@@ -1838,10 +1838,9 @@ void AutomationProvider::GetAutocompleteEditForBrowser(
if (browser_tracker_->ContainsHandle(browser_handle)) {
Browser* browser = browser_tracker_->GetResource(browser_handle);
LocationBarView* loc_bar_view = browser->GetLocationBarView();
- AutocompleteEdit* autocomplete_edit = loc_bar_view->location_entry();
+ AutocompleteEditView* edit_view = loc_bar_view->location_entry();
// Add() returns the existing handle for the resource if any.
- autocomplete_edit_handle =
- autocomplete_edit_tracker_->Add(autocomplete_edit);
+ autocomplete_edit_handle = autocomplete_edit_tracker_->Add(edit_view);
success = true;
}
Send(new AutomationMsg_AutocompleteEditForBrowserResponse(
@@ -2159,9 +2158,8 @@ void AutomationProvider::GetAutocompleteEditText(const IPC::Message& message,
bool success = false;
std::wstring text;
if (autocomplete_edit_tracker_->ContainsHandle(autocomplete_edit_handle)) {
- AutocompleteEdit* edit = autocomplete_edit_tracker_->GetResource(
- autocomplete_edit_handle);
- text = edit->GetText();
+ text = autocomplete_edit_tracker_->GetResource(autocomplete_edit_handle)->
+ GetText();
success = true;
}
Send(new AutomationMsg_AutocompleteEditGetTextResponse(message.routing_id(),
@@ -2173,9 +2171,8 @@ void AutomationProvider::SetAutocompleteEditText(const IPC::Message& message,
const std::wstring& text) {
bool success = false;
if (autocomplete_edit_tracker_->ContainsHandle(autocomplete_edit_handle)) {
- AutocompleteEdit* edit = autocomplete_edit_tracker_->GetResource(
- autocomplete_edit_handle);
- edit->SetUserText(text);
+ autocomplete_edit_tracker_->GetResource(autocomplete_edit_handle)->
+ SetUserText(text);
success = true;
}
Send(new AutomationMsg_AutocompleteEditSetTextResponse(
@@ -2188,9 +2185,8 @@ void AutomationProvider::AutocompleteEditGetMatches(
bool success = false;
std::vector<AutocompleteMatchData> matches;
if (autocomplete_edit_tracker_->ContainsHandle(autocomplete_edit_handle)) {
- AutocompleteEdit* edit =
- autocomplete_edit_tracker_->GetResource(autocomplete_edit_handle);
- const AutocompleteResult* result = edit->latest_result();
+ const AutocompleteResult* result = autocomplete_edit_tracker_->
+ GetResource(autocomplete_edit_handle)->model()->latest_result();
for (AutocompleteResult::const_iterator i = result->begin();
i != result->end(); ++i)
matches.push_back(AutocompleteMatchData(*i));
@@ -2206,9 +2202,8 @@ void AutomationProvider::AutocompleteEditIsQueryInProgress(
bool success = false;
bool query_in_progress = false;
if (autocomplete_edit_tracker_->ContainsHandle(autocomplete_edit_handle)) {
- AutocompleteEdit* edit =
- autocomplete_edit_tracker_->GetResource(autocomplete_edit_handle);
- query_in_progress = edit->query_in_progress();
+ query_in_progress = autocomplete_edit_tracker_->
+ GetResource(autocomplete_edit_handle)->model()->query_in_progress();
success = true;
}
Send(new AutomationMsg_AutocompleteEditIsQueryInProgressResponse(