OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_GTK_H_ | 5 #ifndef CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_EDIT_VIEW_GTK_H_ |
6 #define CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_EDIT_VIEW_GTK_H_ | 6 #define CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_EDIT_VIEW_GTK_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <gtk/gtk.h> | 9 #include <gtk/gtk.h> |
10 | 10 |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 | 98 |
99 virtual void SaveStateToTab(TabContents* tab); | 99 virtual void SaveStateToTab(TabContents* tab); |
100 | 100 |
101 virtual void Update(const TabContents* tab_for_state_restoring); | 101 virtual void Update(const TabContents* tab_for_state_restoring); |
102 | 102 |
103 virtual void OpenURL(const GURL& url, | 103 virtual void OpenURL(const GURL& url, |
104 WindowOpenDisposition disposition, | 104 WindowOpenDisposition disposition, |
105 PageTransition::Type transition, | 105 PageTransition::Type transition, |
106 const GURL& alternate_nav_url, | 106 const GURL& alternate_nav_url, |
107 size_t selected_line, | 107 size_t selected_line, |
108 const std::wstring& keyword); | 108 const string16& keyword); |
109 | 109 |
110 virtual std::wstring GetText() const; | 110 virtual string16 GetText() const; |
111 | 111 |
112 virtual bool IsEditingOrEmpty() const; | 112 virtual bool IsEditingOrEmpty() const; |
113 virtual int GetIcon() const; | 113 virtual int GetIcon() const; |
114 | 114 |
115 virtual void SetUserText(const std::wstring& text); | 115 virtual void SetUserText(const string16& text); |
116 virtual void SetUserText(const std::wstring& text, | 116 virtual void SetUserText(const string16& text, |
117 const std::wstring& display_text, | 117 const string16& display_text, |
118 bool update_popup); | 118 bool update_popup); |
119 | 119 |
120 virtual void SetWindowTextAndCaretPos(const std::wstring& text, | 120 virtual void SetWindowTextAndCaretPos(const string16& text, |
121 size_t caret_pos); | 121 size_t caret_pos); |
122 | 122 |
123 virtual void SetForcedQuery(); | 123 virtual void SetForcedQuery(); |
124 | 124 |
125 virtual bool IsSelectAll(); | 125 virtual bool IsSelectAll(); |
126 virtual bool DeleteAtEndPressed(); | 126 virtual bool DeleteAtEndPressed(); |
127 virtual void GetSelectionBounds(std::wstring::size_type* start, | 127 virtual void GetSelectionBounds(string16::size_type* start, |
128 std::wstring::size_type* end); | 128 string16::size_type* end); |
129 virtual void SelectAll(bool reversed); | 129 virtual void SelectAll(bool reversed); |
130 virtual void RevertAll(); | 130 virtual void RevertAll(); |
131 | 131 |
132 virtual void UpdatePopup(); | 132 virtual void UpdatePopup(); |
133 virtual void ClosePopup(); | 133 virtual void ClosePopup(); |
134 | 134 |
135 virtual void SetFocus(); | 135 virtual void SetFocus(); |
136 | 136 |
137 virtual void OnTemporaryTextMaybeChanged(const std::wstring& display_text, | 137 virtual void OnTemporaryTextMaybeChanged(const string16& display_text, |
138 bool save_original_selection); | 138 bool save_original_selection); |
139 virtual bool OnInlineAutocompleteTextMaybeChanged( | 139 virtual bool OnInlineAutocompleteTextMaybeChanged( |
140 const std::wstring& display_text, size_t user_text_length); | 140 const string16& display_text, size_t user_text_length); |
141 virtual void OnRevertTemporaryText(); | 141 virtual void OnRevertTemporaryText(); |
142 virtual void OnBeforePossibleChange(); | 142 virtual void OnBeforePossibleChange(); |
143 virtual bool OnAfterPossibleChange(); | 143 virtual bool OnAfterPossibleChange(); |
144 virtual gfx::NativeView GetNativeView() const; | 144 virtual gfx::NativeView GetNativeView() const; |
145 virtual CommandUpdater* GetCommandUpdater(); | 145 virtual CommandUpdater* GetCommandUpdater(); |
146 virtual void SetInstantSuggestion(const string16& suggestion); | 146 virtual void SetInstantSuggestion(const string16& suggestion); |
147 virtual int TextWidth() const; | 147 virtual int TextWidth() const; |
148 virtual bool IsImeComposing() const; | 148 virtual bool IsImeComposing() const; |
149 | 149 |
150 #if defined(TOOLKIT_VIEWS) | 150 #if defined(TOOLKIT_VIEWS) |
151 virtual views::View* AddToView(views::View* parent); | 151 virtual views::View* AddToView(views::View* parent); |
152 virtual bool CommitInstantSuggestion(const std::wstring& typed_text, | 152 virtual bool CommitInstantSuggestion(const string16& typed_text, |
153 const std::wstring& suggested_text); | 153 const string16& suggested_text); |
154 | 154 |
155 // Enables accessibility on AutocompleteEditView. | 155 // Enables accessibility on AutocompleteEditView. |
156 void EnableAccessibility(); | 156 void EnableAccessibility(); |
157 | 157 |
158 // A factory method to create an AutocompleteEditView instance initialized for | 158 // A factory method to create an AutocompleteEditView instance initialized for |
159 // linux_views. This currently returns an instance of | 159 // linux_views. This currently returns an instance of |
160 // AutocompleteEditViewGtk only, but AutocompleteEditViewViews will | 160 // AutocompleteEditViewGtk only, but AutocompleteEditViewViews will |
161 // be added as an option when TextfieldViews is enabled. | 161 // be added as an option when TextfieldViews is enabled. |
162 static AutocompleteEditView* Create(AutocompleteEditController* controller, | 162 static AutocompleteEditView* Create(AutocompleteEditController* controller, |
163 ToolbarModel* toolbar_model, | 163 ToolbarModel* toolbar_model, |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 void EmphasizeURLComponents(); | 316 void EmphasizeURLComponents(); |
317 | 317 |
318 // Internally invoked whenever the text changes in some way. | 318 // Internally invoked whenever the text changes in some way. |
319 void TextChanged(); | 319 void TextChanged(); |
320 | 320 |
321 // Save |selected_text| as the PRIMARY X selection. Unlike | 321 // Save |selected_text| as the PRIMARY X selection. Unlike |
322 // OwnPrimarySelection(), this won't set an owner or use callbacks. | 322 // OwnPrimarySelection(), this won't set an owner or use callbacks. |
323 void SavePrimarySelection(const std::string& selected_text); | 323 void SavePrimarySelection(const std::string& selected_text); |
324 | 324 |
325 // Update the field with |text| and set the selection. | 325 // Update the field with |text| and set the selection. |
326 void SetTextAndSelectedRange(const std::wstring& text, | 326 void SetTextAndSelectedRange(const string16& text, |
327 const CharRange& range); | 327 const CharRange& range); |
328 | 328 |
329 // Set the selection to |range|. | 329 // Set the selection to |range|. |
330 void SetSelectedRange(const CharRange& range); | 330 void SetSelectedRange(const CharRange& range); |
331 | 331 |
332 // Adjust the text justification according to the text direction of the widget | 332 // Adjust the text justification according to the text direction of the widget |
333 // and |text_buffer_|'s content, to make sure the real text justification is | 333 // and |text_buffer_|'s content, to make sure the real text justification is |
334 // always in sync with the UI language direction. | 334 // always in sync with the UI language direction. |
335 void AdjustTextJustification(); | 335 void AdjustTextJustification(); |
336 | 336 |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 // different presentation (smaller font size). This is used for popups. | 401 // different presentation (smaller font size). This is used for popups. |
402 bool popup_window_mode_; | 402 bool popup_window_mode_; |
403 | 403 |
404 ToolbarModel::SecurityLevel security_level_; | 404 ToolbarModel::SecurityLevel security_level_; |
405 | 405 |
406 // Selection at the point where the user started using the | 406 // Selection at the point where the user started using the |
407 // arrows to move around in the popup. | 407 // arrows to move around in the popup. |
408 CharRange saved_temporary_selection_; | 408 CharRange saved_temporary_selection_; |
409 | 409 |
410 // Tracking state before and after a possible change. | 410 // Tracking state before and after a possible change. |
411 std::wstring text_before_change_; | 411 string16 text_before_change_; |
412 CharRange sel_before_change_; | 412 CharRange sel_before_change_; |
413 | 413 |
414 // The most-recently-selected text from the entry that was copied to the | 414 // The most-recently-selected text from the entry that was copied to the |
415 // clipboard. This is updated on-the-fly as the user selects text. This may | 415 // clipboard. This is updated on-the-fly as the user selects text. This may |
416 // differ from the actual selected text, such as when 'http://' is prefixed to | 416 // differ from the actual selected text, such as when 'http://' is prefixed to |
417 // the text. It is used in cases where we need to make the PRIMARY selection | 417 // the text. It is used in cases where we need to make the PRIMARY selection |
418 // persist even after the user has unhighlighted the text in the view | 418 // persist even after the user has unhighlighted the text in the view |
419 // (e.g. when they highlight some text and then click to unhighlight it, we | 419 // (e.g. when they highlight some text and then click to unhighlight it, we |
420 // pass this string to SavePrimarySelection()). | 420 // pass this string to SavePrimarySelection()). |
421 std::string selected_text_; | 421 std::string selected_text_; |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
504 // Indicates if omnibox's content maybe changed by a key press event, so that | 504 // Indicates if omnibox's content maybe changed by a key press event, so that |
505 // we need to call OnAfterPossibleChange() after handling the event. | 505 // we need to call OnAfterPossibleChange() after handling the event. |
506 // This flag should be set for changes directly caused by a key press event, | 506 // This flag should be set for changes directly caused by a key press event, |
507 // including changes to content text, selection range and preedit string. | 507 // including changes to content text, selection range and preedit string. |
508 // Changes caused by function calls like SetUserText() should not affect this | 508 // Changes caused by function calls like SetUserText() should not affect this |
509 // flag. | 509 // flag. |
510 bool content_maybe_changed_by_key_press_; | 510 bool content_maybe_changed_by_key_press_; |
511 | 511 |
512 #if GTK_CHECK_VERSION(2, 20, 0) | 512 #if GTK_CHECK_VERSION(2, 20, 0) |
513 // Stores the text being composed by the input method. | 513 // Stores the text being composed by the input method. |
514 std::wstring preedit_; | 514 string16 preedit_; |
515 | 515 |
516 // Tracking preedit state before and after a possible change. We don't need to | 516 // Tracking preedit state before and after a possible change. We don't need to |
517 // track preedit_'s content, as it'll be treated as part of text content. | 517 // track preedit_'s content, as it'll be treated as part of text content. |
518 size_t preedit_size_before_change_; | 518 size_t preedit_size_before_change_; |
519 #endif | 519 #endif |
520 | 520 |
521 // The view that is going to be focused next. Only valid while handling | 521 // The view that is going to be focused next. Only valid while handling |
522 // "focus-out" events. | 522 // "focus-out" events. |
523 GtkWidget* going_to_focus_; | 523 GtkWidget* going_to_focus_; |
524 | 524 |
525 ui::GtkSignalRegistrar signals_; | 525 ui::GtkSignalRegistrar signals_; |
526 | 526 |
527 #if defined(TOOLKIT_VIEWS) | 527 #if defined(TOOLKIT_VIEWS) |
528 scoped_ptr<AccessibleWidgetHelper> accessible_widget_helper_; | 528 scoped_ptr<AccessibleWidgetHelper> accessible_widget_helper_; |
529 #endif | 529 #endif |
530 | 530 |
531 DISALLOW_COPY_AND_ASSIGN(AutocompleteEditViewGtk); | 531 DISALLOW_COPY_AND_ASSIGN(AutocompleteEditViewGtk); |
532 }; | 532 }; |
533 | 533 |
534 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_EDIT_VIEW_GTK_H_ | 534 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_EDIT_VIEW_GTK_H_ |
OLD | NEW |