diff options
author | brettw@google.com <brettw@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-12 20:16:50 +0000 |
---|---|---|
committer | brettw@google.com <brettw@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-12 20:16:50 +0000 |
commit | 76960a40e09420ac2e302f4b307c4dd0d8a61ce8 (patch) | |
tree | 8f6a5642af430f77528fd479eba63dfae42169d8 /chrome/browser/autocomplete | |
parent | 45cbfb0444d2ae27d9dbc9880c547c0d42978782 (diff) | |
download | chromium_src-76960a40e09420ac2e302f4b307c4dd0d8a61ce8.zip chromium_src-76960a40e09420ac2e302f4b307c4dd0d8a61ce8.tar.gz chromium_src-76960a40e09420ac2e302f4b307c4dd0d8a61ce8.tar.bz2 |
Add PropertyBag to TabContents. Convert the autocomplete state as a proof of concept. Add necessary const accessors to property bag.
BUG=5260
Review URL: http://codereview.chromium.org/13707
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@6920 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/autocomplete')
-rw-r--r-- | chrome/browser/autocomplete/autocomplete_edit.cc | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/chrome/browser/autocomplete/autocomplete_edit.cc b/chrome/browser/autocomplete/autocomplete_edit.cc index 03267af..6fb50f1 100644 --- a/chrome/browser/autocomplete/autocomplete_edit.cc +++ b/chrome/browser/autocomplete/autocomplete_edit.cc @@ -645,6 +645,13 @@ static const SkColor kSchemeSelectedStrikeoutColor = static HWND edit_hwnd = NULL; static PAINTSTRUCT paint_struct; +// Returns a lazily initialized property bag accessor for saving our state in a +// TabContents. +static PropertyAccessor<AutocompleteEditState>* GetStateAccessor() { + static PropertyAccessor<AutocompleteEditState> state; + return &state; +} + AutocompleteEditView::AutocompleteEditView( const ChromeFont& font, AutocompleteEditController* controller, @@ -787,8 +794,10 @@ void AutocompleteEditView::SaveStateToTab(TabContents* tab) { CHARRANGE selection; GetSelection(selection); - tab->set_saved_location_bar_state(new AutocompleteEditState(model_state, - State(selection, saved_selection_for_focus_change_))); + GetStateAccessor()->SetProperty(tab->property_bag(), + AutocompleteEditState( + model_state, + State(selection, saved_selection_for_focus_change_))); } void AutocompleteEditView::Update(const TabContents* tab_for_state_restoring) { @@ -825,8 +834,8 @@ void AutocompleteEditView::Update(const TabContents* tab_for_state_restoring) { // won't overwrite all our local state. RevertAll(); - const AutocompleteEditState* const state = - tab_for_state_restoring->saved_location_bar_state(); + const AutocompleteEditState* state = GetStateAccessor()->GetProperty( + tab_for_state_restoring->property_bag()); if (state) { model_->RestoreState(state->model_state); |