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

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

Issue 6036004: Refactor AutocompleteEditViewGtk so that AutocompleteEditView impl can be swapped. (Closed) Base URL: svn://svn.chromium.org/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) 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 // This file defines the interface class AutocompleteEditView. Each toolkit 5 // This file defines the interface class AutocompleteEditView. Each toolkit
6 // will implement the edit view differently, so that code is inherently 6 // will implement the edit view differently, so that code is inherently
7 // platform specific. However, the AutocompleteEditModel needs to do some 7 // platform specific. However, the AutocompleteEditModel needs to do some
8 // communication with the view. Since the model is shared between platforms, 8 // communication with the view. Since the model is shared between platforms,
9 // we need to define an interface that all view implementations will share. 9 // we need to define an interface that all view implementations will share.
10 10
11 #ifndef CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_EDIT_VIEW_H_ 11 #ifndef CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_EDIT_VIEW_H_
12 #define CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_EDIT_VIEW_H_ 12 #define CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_EDIT_VIEW_H_
13 #pragma once 13 #pragma once
14 14
15 #include <string> 15 #include <string>
16 16
17 #include "base/string16.h" 17 #include "base/string16.h"
18 #include "chrome/common/page_transition_types.h" 18 #include "chrome/common/page_transition_types.h"
19 #include "gfx/native_widget_types.h" 19 #include "gfx/native_widget_types.h"
20 #include "webkit/glue/window_open_disposition.h" 20 #include "webkit/glue/window_open_disposition.h"
21 21
22 class AutocompleteEditModel; 22 class AutocompleteEditModel;
23 class CommandUpdater; 23 class CommandUpdater;
24 class GURL; 24 class GURL;
25 class TabContents; 25 class TabContents;
26 26
27 #if defined(TOOLKIT_VIEWS)
28 namespace views {
29 class View;
30 } // namespace views
31 #endif
32
27 class AutocompleteEditView { 33 class AutocompleteEditView {
28 public: 34 public:
29 // Used by the automation system for getting at the model from the view. 35 // Used by the automation system for getting at the model from the view.
30 virtual AutocompleteEditModel* model() = 0; 36 virtual AutocompleteEditModel* model() = 0;
31 virtual const AutocompleteEditModel* model() const = 0; 37 virtual const AutocompleteEditModel* model() const = 0;
32 38
33 // For use when switching tabs, this saves the current state onto the tab so 39 // For use when switching tabs, this saves the current state onto the tab so
34 // that it can be restored during a later call to Update(). 40 // that it can be restored during a later call to Update().
35 virtual void SaveStateToTab(TabContents* tab) = 0; 41 virtual void SaveStateToTab(TabContents* tab) = 0;
36 42
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 // OnAfterPossibleChange() returns true if there was a change that caused it 151 // OnAfterPossibleChange() returns true if there was a change that caused it
146 // to call UpdatePopup(). 152 // to call UpdatePopup().
147 virtual bool OnAfterPossibleChange() = 0; 153 virtual bool OnAfterPossibleChange() = 0;
148 154
149 // Returns the gfx::NativeView of the edit view. 155 // Returns the gfx::NativeView of the edit view.
150 virtual gfx::NativeView GetNativeView() const = 0; 156 virtual gfx::NativeView GetNativeView() const = 0;
151 157
152 // Returns the command updater for this view. 158 // Returns the command updater for this view.
153 virtual CommandUpdater* GetCommandUpdater() = 0; 159 virtual CommandUpdater* GetCommandUpdater() = 0;
154 160
155 protected: 161 #if defined(TOOLKIT_VIEWS)
162 // Adds the autocomplete edit view to view hierarchy and
163 // returns the views::View of the edit view.
164 virtual views::View* AddToView(views::View* parent) = 0;
165
166 // Returns the width in pixels needed to display the current text. The
Peter Kasting 2011/01/06 20:51:38 Nit: Might want to move this to the end so that th
oshima 2011/01/06 21:39:27 Done. moved implementation as well.
167 // returned value includes margins.
168 virtual int TextWidth() const = 0;
169
170 // Commits the suggested text.
171 virtual bool CommitInstantSuggestion(const std::wstring& typed_text,
172 const std::wstring& suggested_text) = 0;
173
174 // Shows the instant suggestion text.
175 virtual void SetInstantSuggestion(const string16& input) = 0;
176 #endif
177
156 virtual ~AutocompleteEditView() {} 178 virtual ~AutocompleteEditView() {}
157 }; 179 };
158 180
159 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_EDIT_VIEW_H_ 181 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_EDIT_VIEW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698