| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 #ifndef CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_EDIT_VIEW_MAC_H_ | 5 #ifndef CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_EDIT_VIEW_MAC_H_ |
| 6 #define CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_EDIT_VIEW_MAC_H_ | 6 #define CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_EDIT_VIEW_MAC_H_ |
| 7 | 7 |
| 8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/scoped_nsobject.h" | 11 #include "base/scoped_nsobject.h" |
| 12 #include "base/scoped_ptr.h" | 12 #include "base/scoped_ptr.h" |
| 13 #include "chrome/browser/autocomplete/autocomplete.h" | 13 #include "chrome/browser/autocomplete/autocomplete.h" |
| 14 #include "chrome/browser/autocomplete/autocomplete_edit_view.h" | 14 #include "chrome/browser/autocomplete/autocomplete_edit_view.h" |
| 15 #include "chrome/browser/toolbar_model.h" | 15 #include "chrome/browser/toolbar_model.h" |
| 16 #include "chrome/common/page_transition_types.h" | 16 #include "chrome/common/page_transition_types.h" |
| 17 #include "webkit/glue/window_open_disposition.h" | 17 #include "webkit/glue/window_open_disposition.h" |
| 18 | 18 |
| 19 class AutocompleteEditController; | 19 class AutocompleteEditController; |
| 20 @class AutocompleteEditHelper; | 20 @class AutocompleteEditHelper; |
| 21 class AutocompleteEditModel; | 21 class AutocompleteEditModel; |
| 22 class AutocompletePopupViewMac; | 22 class AutocompletePopupViewMac; |
| 23 @class AutocompleteTextField; |
| 23 class CommandUpdater; | 24 class CommandUpdater; |
| 24 class Profile; | 25 class Profile; |
| 25 class TabContents; | 26 class TabContents; |
| 26 class ToolbarModel; | 27 class ToolbarModel; |
| 27 | 28 |
| 28 // Implements AutocompleteEditView on an NSTextField. | 29 // Implements AutocompleteEditView on an AutocompleteTextField. |
| 29 | 30 |
| 30 class AutocompleteEditViewMac : public AutocompleteEditView { | 31 class AutocompleteEditViewMac : public AutocompleteEditView { |
| 31 public: | 32 public: |
| 32 AutocompleteEditViewMac(AutocompleteEditController* controller, | 33 AutocompleteEditViewMac(AutocompleteEditController* controller, |
| 33 ToolbarModel* toolbar_model, | 34 ToolbarModel* toolbar_model, |
| 34 Profile* profile, | 35 Profile* profile, |
| 35 CommandUpdater* command_updater, | 36 CommandUpdater* command_updater, |
| 36 NSTextField* field); | 37 AutocompleteTextField* field); |
| 37 virtual ~AutocompleteEditViewMac(); | 38 virtual ~AutocompleteEditViewMac(); |
| 38 | 39 |
| 39 // Implement the AutocompleteEditView interface. | 40 // Implement the AutocompleteEditView interface. |
| 40 // TODO(shess): See if this couldn't be simplified to: | 41 // TODO(shess): See if this couldn't be simplified to: |
| 41 // virtual AEM* model() const { ... } | 42 // virtual AEM* model() const { ... } |
| 42 virtual AutocompleteEditModel* model() { return model_.get(); } | 43 virtual AutocompleteEditModel* model() { return model_.get(); } |
| 43 virtual const AutocompleteEditModel* model() const { return model_.get(); } | 44 virtual const AutocompleteEditModel* model() const { return model_.get(); } |
| 44 | 45 |
| 45 virtual void SaveStateToTab(TabContents* tab); | 46 virtual void SaveStateToTab(TabContents* tab); |
| 46 virtual void Update(const TabContents* tab_for_state_restoring); | 47 virtual void Update(const TabContents* tab_for_state_restoring); |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 scoped_ptr<AutocompleteEditModel> model_; | 134 scoped_ptr<AutocompleteEditModel> model_; |
| 134 scoped_ptr<AutocompletePopupViewMac> popup_view_; | 135 scoped_ptr<AutocompletePopupViewMac> popup_view_; |
| 135 | 136 |
| 136 AutocompleteEditController* controller_; | 137 AutocompleteEditController* controller_; |
| 137 ToolbarModel* toolbar_model_; | 138 ToolbarModel* toolbar_model_; |
| 138 | 139 |
| 139 // The object that handles additional command functionality exposed on the | 140 // The object that handles additional command functionality exposed on the |
| 140 // edit, such as invoking the keyword editor. | 141 // edit, such as invoking the keyword editor. |
| 141 CommandUpdater* command_updater_; | 142 CommandUpdater* command_updater_; |
| 142 | 143 |
| 143 NSTextField* field_; // owned by tab controller | 144 AutocompleteTextField* field_; // owned by tab controller |
| 144 | 145 |
| 145 // Objective-C object to bridge field_ delegate calls to C++. | 146 // Objective-C object to bridge field_ delegate calls to C++. |
| 146 scoped_nsobject<AutocompleteEditHelper> edit_helper_; | 147 scoped_nsobject<AutocompleteEditHelper> edit_helper_; |
| 147 | 148 |
| 148 // Text and selection at the point where the user started using the | 149 // Text and selection at the point where the user started using the |
| 149 // arrows to move around in the popup. | 150 // arrows to move around in the popup. |
| 150 NSRange saved_temporary_selection_; | 151 NSRange saved_temporary_selection_; |
| 151 std::wstring saved_temporary_text_; | 152 std::wstring saved_temporary_text_; |
| 152 | 153 |
| 153 // Tracking state before and after a possible change for reporting | 154 // Tracking state before and after a possible change for reporting |
| 154 // to model_. | 155 // to model_. |
| 155 NSRange selection_before_change_; | 156 NSRange selection_before_change_; |
| 156 std::wstring text_before_change_; | 157 std::wstring text_before_change_; |
| 157 | 158 |
| 158 DISALLOW_COPY_AND_ASSIGN(AutocompleteEditViewMac); | 159 DISALLOW_COPY_AND_ASSIGN(AutocompleteEditViewMac); |
| 159 }; | 160 }; |
| 160 | 161 |
| 161 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_EDIT_VIEW_MAC_H_ | 162 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_EDIT_VIEW_MAC_H_ |
| OLD | NEW |