Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(320)

Side by Side Diff: chrome/browser/autocomplete/autocomplete_edit_view_views.h

Issue 6258015: Remove wstring from autocomplete.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_VIEWS_H_ 5 #ifndef CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_EDIT_VIEW_VIEWS_H_
6 #define CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_EDIT_VIEW_VIEWS_H_ 6 #define CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_EDIT_VIEW_VIEWS_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 10
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 74
75 virtual void SaveStateToTab(TabContents* tab); 75 virtual void SaveStateToTab(TabContents* tab);
76 76
77 virtual void Update(const TabContents* tab_for_state_restoring); 77 virtual void Update(const TabContents* tab_for_state_restoring);
78 78
79 virtual void OpenURL(const GURL& url, 79 virtual void OpenURL(const GURL& url,
80 WindowOpenDisposition disposition, 80 WindowOpenDisposition disposition,
81 PageTransition::Type transition, 81 PageTransition::Type transition,
82 const GURL& alternate_nav_url, 82 const GURL& alternate_nav_url,
83 size_t selected_line, 83 size_t selected_line,
84 const std::wstring& keyword); 84 const string16& keyword);
85 85
86 virtual std::wstring GetText() const; 86 virtual string16 GetText() const;
87 87
88 virtual bool IsEditingOrEmpty() const; 88 virtual bool IsEditingOrEmpty() const;
89 virtual int GetIcon() const; 89 virtual int GetIcon() const;
90 virtual void SetUserText(const std::wstring& text); 90 virtual void SetUserText(const string16& text);
91 virtual void SetUserText(const std::wstring& text, 91 virtual void SetUserText(const string16& text,
92 const std::wstring& display_text, 92 const string16& display_text,
93 bool update_popup); 93 bool update_popup);
94 virtual void SetWindowTextAndCaretPos(const std::wstring& text, 94 virtual void SetWindowTextAndCaretPos(const string16& text,
95 size_t caret_pos); 95 size_t caret_pos);
96 virtual void SetForcedQuery(); 96 virtual void SetForcedQuery();
97 virtual bool IsSelectAll(); 97 virtual bool IsSelectAll();
98 virtual bool DeleteAtEndPressed(); 98 virtual bool DeleteAtEndPressed();
99 virtual void GetSelectionBounds(std::wstring::size_type* start, 99 virtual void GetSelectionBounds(string16::size_type* start,
100 std::wstring::size_type* end); 100 string16::size_type* end);
101 virtual void SelectAll(bool reversed); 101 virtual void SelectAll(bool reversed);
102 virtual void RevertAll(); 102 virtual void RevertAll();
103 virtual void UpdatePopup(); 103 virtual void UpdatePopup();
104 virtual void ClosePopup(); 104 virtual void ClosePopup();
105 virtual void SetFocus(); 105 virtual void SetFocus();
106 virtual void OnTemporaryTextMaybeChanged(const std::wstring& display_text, 106 virtual void OnTemporaryTextMaybeChanged(const string16& display_text,
107 bool save_original_selection); 107 bool save_original_selection);
108 virtual bool OnInlineAutocompleteTextMaybeChanged( 108 virtual bool OnInlineAutocompleteTextMaybeChanged(
109 const std::wstring& display_text, size_t user_text_length); 109 const string16& display_text, size_t user_text_length);
110 virtual void OnRevertTemporaryText(); 110 virtual void OnRevertTemporaryText();
111 virtual void OnBeforePossibleChange(); 111 virtual void OnBeforePossibleChange();
112 virtual bool OnAfterPossibleChange(); 112 virtual bool OnAfterPossibleChange();
113 virtual gfx::NativeView GetNativeView() const; 113 virtual gfx::NativeView GetNativeView() const;
114 virtual CommandUpdater* GetCommandUpdater(); 114 virtual CommandUpdater* GetCommandUpdater();
115 virtual views::View* AddToView(views::View* parent); 115 virtual views::View* AddToView(views::View* parent);
116 virtual int TextWidth() const; 116 virtual int TextWidth() const;
117 virtual bool IsImeComposing() const; 117 virtual bool IsImeComposing() const;
118 virtual bool CommitInstantSuggestion(const std::wstring& typed_text, 118 virtual bool CommitInstantSuggestion(const string16& typed_text,
119 const std::wstring& suggested_text); 119 const string16& suggested_text);
120 virtual void SetInstantSuggestion(const string16& input); 120 virtual void SetInstantSuggestion(const string16& input);
121 121
122 // Overridden from NotificationObserver: 122 // Overridden from NotificationObserver:
123 virtual void Observe(NotificationType type, 123 virtual void Observe(NotificationType type,
124 const NotificationSource& source, 124 const NotificationSource& source,
125 const NotificationDetails& details); 125 const NotificationDetails& details);
126 126
127 // Overridden from Textfield::Controller 127 // Overridden from Textfield::Controller
128 virtual void ContentsChanged(views::Textfield* sender, 128 virtual void ContentsChanged(views::Textfield* sender,
129 const string16& new_contents); 129 const string16& new_contents);
130 virtual bool HandleKeyEvent(views::Textfield* sender, 130 virtual bool HandleKeyEvent(views::Textfield* sender,
131 const views::KeyEvent& key_event); 131 const views::KeyEvent& key_event);
132 132
133 private: 133 private:
134 // Return the number of characers in the current buffer. 134 // Return the number of characers in the current buffer.
135 size_t GetTextLength() const; 135 size_t GetTextLength() const;
136 136
137 // Try to parse the current text as a URL and colorize the components. 137 // Try to parse the current text as a URL and colorize the components.
138 void EmphasizeURLComponents(); 138 void EmphasizeURLComponents();
139 139
140 // Internally invoked whenever the text changes in some way. 140 // Internally invoked whenever the text changes in some way.
141 void TextChanged(); 141 void TextChanged();
142 142
143 // Update the field with |text| and set the selection. 143 // Update the field with |text| and set the selection.
144 void SetTextAndSelectedRange(const std::wstring& text, 144 void SetTextAndSelectedRange(const string16& text,
145 const views::TextRange& range); 145 const views::TextRange& range);
146 146
147 // Returns the selected text. 147 // Returns the selected text.
148 string16 GetSelectedText() const; 148 string16 GetSelectedText() const;
149 149
150 // Selects the text given by |caret| and |end|. 150 // Selects the text given by |caret| and |end|.
151 void SelectRange(size_t caret, size_t end); 151 void SelectRange(size_t caret, size_t end);
152 152
153 views::Textfield* textfield_; 153 views::Textfield* textfield_;
154 154
(...skipping 10 matching lines...) Expand all
165 // different presentation (smaller font size). This is used for popups. 165 // different presentation (smaller font size). This is used for popups.
166 bool popup_window_mode_; 166 bool popup_window_mode_;
167 167
168 ToolbarModel::SecurityLevel security_level_; 168 ToolbarModel::SecurityLevel security_level_;
169 169
170 // Selection at the point where the user started using the 170 // Selection at the point where the user started using the
171 // arrows to move around in the popup. 171 // arrows to move around in the popup.
172 views::TextRange saved_temporary_selection_; 172 views::TextRange saved_temporary_selection_;
173 173
174 // Tracking state before and after a possible change. 174 // Tracking state before and after a possible change.
175 std::wstring text_before_change_; 175 string16 text_before_change_;
176 views::TextRange sel_before_change_; 176 views::TextRange sel_before_change_;
177 177
178 // TODO(oshima): following flags are copied from gtk implementation. 178 // TODO(oshima): following flags are copied from gtk implementation.
179 // It should be possible to refactor this class to simplify flags and 179 // It should be possible to refactor this class to simplify flags and
180 // logic. I'll work on this refactoring once all features are completed. 180 // logic. I'll work on this refactoring once all features are completed.
181 181
182 // Indicates whether the IME changed the text. It's possible for the IME to 182 // Indicates whether the IME changed the text. It's possible for the IME to
183 // handle a key event but not change the text contents (e.g., when pressing 183 // handle a key event but not change the text contents (e.g., when pressing
184 // shift+del with no selection). 184 // shift+del with no selection).
185 bool text_changed_; 185 bool text_changed_;
(...skipping 12 matching lines...) Expand all
198 // This flag should be set for changes directly caused by a key press event, 198 // This flag should be set for changes directly caused by a key press event,
199 // including changes to content text, selection range and preedit string. 199 // including changes to content text, selection range and preedit string.
200 // Changes caused by function calls like SetUserText() should not affect this 200 // Changes caused by function calls like SetUserText() should not affect this
201 // flag. 201 // flag.
202 bool content_maybe_changed_by_key_press_; 202 bool content_maybe_changed_by_key_press_;
203 203
204 DISALLOW_COPY_AND_ASSIGN(AutocompleteEditViewViews); 204 DISALLOW_COPY_AND_ASSIGN(AutocompleteEditViewViews);
205 }; 205 };
206 206
207 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_EDIT_VIEW_VIEWS_H_ 207 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_EDIT_VIEW_VIEWS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698