| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/scoped_ptr.h" | 10 #include "base/scoped_ptr.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 public AutocompleteTextFieldObserver { | 23 public AutocompleteTextFieldObserver { |
| 24 public: | 24 public: |
| 25 AutocompleteEditViewMac(AutocompleteEditController* controller, | 25 AutocompleteEditViewMac(AutocompleteEditController* controller, |
| 26 ToolbarModel* toolbar_model, | 26 ToolbarModel* toolbar_model, |
| 27 Profile* profile, | 27 Profile* profile, |
| 28 CommandUpdater* command_updater, | 28 CommandUpdater* command_updater, |
| 29 AutocompleteTextField* field); | 29 AutocompleteTextField* field); |
| 30 virtual ~AutocompleteEditViewMac(); | 30 virtual ~AutocompleteEditViewMac(); |
| 31 | 31 |
| 32 // Implement the AutocompleteEditView interface. | 32 // Implement the AutocompleteEditView interface. |
| 33 // TODO(shess): See if this couldn't be simplified to: | |
| 34 // virtual AEM* model() const { ... } | |
| 35 virtual AutocompleteEditModel* model() { return model_.get(); } | 33 virtual AutocompleteEditModel* model() { return model_.get(); } |
| 36 virtual const AutocompleteEditModel* model() const { return model_.get(); } | 34 virtual const AutocompleteEditModel* model() const { return model_.get(); } |
| 37 | 35 |
| 38 virtual void SaveStateToTab(TabContents* tab); | 36 virtual void SaveStateToTab(TabContents* tab); |
| 39 virtual void Update(const TabContents* tab_for_state_restoring); | 37 virtual void Update(const TabContents* tab_for_state_restoring); |
| 40 | 38 |
| 41 virtual void OpenURL(const GURL& url, | 39 virtual void OpenURL(const GURL& url, |
| 42 WindowOpenDisposition disposition, | 40 WindowOpenDisposition disposition, |
| 43 PageTransition::Type transition, | 41 PageTransition::Type transition, |
| 44 const GURL& alternate_nav_url, | 42 const GURL& alternate_nav_url, |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 virtual void OnSetFocus(bool control_down); | 94 virtual void OnSetFocus(bool control_down); |
| 97 virtual void OnKillFocus(); | 95 virtual void OnKillFocus(); |
| 98 | 96 |
| 99 // Helper for LocationBarViewMac. Optionally selects all in |field_|. | 97 // Helper for LocationBarViewMac. Optionally selects all in |field_|. |
| 100 void FocusLocation(bool select_all); | 98 void FocusLocation(bool select_all); |
| 101 | 99 |
| 102 // Helper to get appropriate contents from |clipboard|. Returns | 100 // Helper to get appropriate contents from |clipboard|. Returns |
| 103 // empty string if no appropriate data is found on |clipboard|. | 101 // empty string if no appropriate data is found on |clipboard|. |
| 104 static std::wstring GetClipboardText(Clipboard* clipboard); | 102 static std::wstring GetClipboardText(Clipboard* clipboard); |
| 105 | 103 |
| 104 // Helper to get the font to use in the field, exposed for the |
| 105 // popup. |
| 106 static NSFont* GetFieldFont(); |
| 107 |
| 106 // If |resource_id| has a PDF image which can be used, return it. | 108 // If |resource_id| has a PDF image which can be used, return it. |
| 107 // Otherwise return the PNG image from the resource bundle. | 109 // Otherwise return the PNG image from the resource bundle. |
| 108 static NSImage* ImageForResource(int resource_id); | 110 static NSImage* ImageForResource(int resource_id); |
| 109 | 111 |
| 110 private: | 112 private: |
| 111 // Called when the user hits backspace in |field_|. Checks whether | 113 // Called when the user hits backspace in |field_|. Checks whether |
| 112 // keyword search is being terminated. Returns true if the | 114 // keyword search is being terminated. Returns true if the |
| 113 // backspace should be intercepted (not forwarded on to the standard | 115 // backspace should be intercepted (not forwarded on to the standard |
| 114 // machinery). | 116 // machinery). |
| 115 bool OnBackspacePressed(); | 117 bool OnBackspacePressed(); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 NSRange selection_before_change_; | 168 NSRange selection_before_change_; |
| 167 std::wstring text_before_change_; | 169 std::wstring text_before_change_; |
| 168 | 170 |
| 169 // The maximum/standard line height for the displayed text. | 171 // The maximum/standard line height for the displayed text. |
| 170 CGFloat line_height_; | 172 CGFloat line_height_; |
| 171 | 173 |
| 172 DISALLOW_COPY_AND_ASSIGN(AutocompleteEditViewMac); | 174 DISALLOW_COPY_AND_ASSIGN(AutocompleteEditViewMac); |
| 173 }; | 175 }; |
| 174 | 176 |
| 175 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_EDIT_VIEW_MAC_H_ | 177 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_EDIT_VIEW_MAC_H_ |
| OLD | NEW |