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

Side by Side Diff: chrome/browser/autocomplete/autocomplete_edit_view_gtk.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 #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
11 #include <algorithm> 11 #include <algorithm>
12 #include <string> 12 #include <string>
13 13
14 #include "app/animation_delegate.h" 14 #include "app/animation_delegate.h"
15 #include "app/gtk_signal.h" 15 #include "app/gtk_signal.h"
16 #include "app/gtk_signal_registrar.h" 16 #include "app/gtk_signal_registrar.h"
17 #include "base/basictypes.h" 17 #include "base/basictypes.h"
18 #include "base/scoped_ptr.h" 18 #include "base/scoped_ptr.h"
19 #include "base/string_util.h" 19 #include "base/string_util.h"
20 #include "chrome/browser/autocomplete/autocomplete_edit_view.h" 20 #include "chrome/browser/autocomplete/autocomplete_edit_view.h"
21 #include "chrome/browser/gtk/owned_widget_gtk.h" 21 #include "chrome/browser/gtk/owned_widget_gtk.h"
22 #include "chrome/browser/ui/toolbar/toolbar_model.h" 22 #include "chrome/browser/ui/toolbar/toolbar_model.h"
23 #include "chrome/common/notification_observer.h" 23 #include "chrome/common/notification_observer.h"
24 #include "chrome/common/notification_registrar.h" 24 #include "chrome/common/notification_registrar.h"
25 #include "chrome/common/page_transition_types.h" 25 #include "chrome/common/page_transition_types.h"
26 #include "gfx/rect.h" 26 #include "gfx/rect.h"
27 #include "webkit/glue/window_open_disposition.h" 27 #include "webkit/glue/window_open_disposition.h"
28 28
29 class AccessibleWidgetHelper;
29 class AutocompleteEditController; 30 class AutocompleteEditController;
30 class AutocompleteEditModel; 31 class AutocompleteEditModel;
31 class AutocompletePopupView; 32 class AutocompletePopupView;
32 class MultiAnimation; 33 class MultiAnimation;
33 class Profile; 34 class Profile;
34 class TabContents; 35 class TabContents;
35 36
36 namespace gfx{ 37 namespace gfx{
37 class Font; 38 class Font;
38 } 39 }
(...skipping 25 matching lines...) Expand all
64 int cp_min; // For a selection: Represents the start. 65 int cp_min; // For a selection: Represents the start.
65 int cp_max; // For a selection: Represents the end (insert position). 66 int cp_max; // For a selection: Represents the end (insert position).
66 }; 67 };
67 68
68 AutocompleteEditViewGtk(AutocompleteEditController* controller, 69 AutocompleteEditViewGtk(AutocompleteEditController* controller,
69 ToolbarModel* toolbar_model, 70 ToolbarModel* toolbar_model,
70 Profile* profile, 71 Profile* profile,
71 CommandUpdater* command_updater, 72 CommandUpdater* command_updater,
72 bool popup_window_mode, 73 bool popup_window_mode,
73 #if defined(TOOLKIT_VIEWS) 74 #if defined(TOOLKIT_VIEWS)
74 const views::View* location_bar); 75 const views::View* location_bar
75 #else 76 #else
76 GtkWidget* location_bar); 77 GtkWidget* location_bar
77 #endif 78 #endif
78 ~AutocompleteEditViewGtk(); 79 );
Peter Kasting 2011/01/06 02:06:48 Nit: I slightly prefer leaving the ); on the indiv
oshima 2011/01/06 19:43:35 unbalanced parenthesis and brackets confused emacs
Peter Kasting 2011/01/06 20:51:38 I don't feel strongly, but I do think the old way
oshima 2011/01/06 21:39:26 This code is gtk (thus linux) code and I assume th
80 virtual ~AutocompleteEditViewGtk();
79 81
80 // Initialize, create the underlying widgets, etc. 82 // Initialize, create the underlying widgets, etc.
81 void Init(); 83 void Init();
82
83 // Returns the width in pixels needed to display the current text. The
84 // returned value includes margins.
85 int TextWidth();
86
87 // Returns the width in pixels needed to display the text from one character 84 // Returns the width in pixels needed to display the text from one character
88 // before the caret to the end of the string. See comments in 85 // before the caret to the end of the string. See comments in
89 // LocationBarView::Layout as to why this uses -1. 86 // LocationBarView::Layout as to why this uses -1.
90 int WidthOfTextAfterCursor(); 87 int WidthOfTextAfterCursor();
91 88
92 // Returns the font. 89 // Returns the font.
93 gfx::Font GetFont(); 90 gfx::Font GetFont();
94 91
95 // Implement the AutocompleteEditView interface. 92 // Implement the AutocompleteEditView interface.
96 virtual AutocompleteEditModel* model(); 93 virtual AutocompleteEditModel* model();
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 133
137 virtual void OnTemporaryTextMaybeChanged(const std::wstring& display_text, 134 virtual void OnTemporaryTextMaybeChanged(const std::wstring& display_text,
138 bool save_original_selection); 135 bool save_original_selection);
139 virtual bool OnInlineAutocompleteTextMaybeChanged( 136 virtual bool OnInlineAutocompleteTextMaybeChanged(
140 const std::wstring& display_text, size_t user_text_length); 137 const std::wstring& display_text, size_t user_text_length);
141 virtual void OnRevertTemporaryText(); 138 virtual void OnRevertTemporaryText();
142 virtual void OnBeforePossibleChange(); 139 virtual void OnBeforePossibleChange();
143 virtual bool OnAfterPossibleChange(); 140 virtual bool OnAfterPossibleChange();
144 virtual gfx::NativeView GetNativeView() const; 141 virtual gfx::NativeView GetNativeView() const;
145 virtual CommandUpdater* GetCommandUpdater(); 142 virtual CommandUpdater* GetCommandUpdater();
143 #if defined(TOOLKIT_VIEWS)
144 virtual int TextWidth() const;
145 virtual views::View* AddToView(views::View* parent);
146 virtual bool CommitInstantSuggestion(const std::wstring& typed_text,
147 const std::wstring& suggested_text);
148 virtual void SetInstantSuggestion(const string16& suggestion);
149
150 void CreateAccessibleWidgetHelper(int res);
Peter Kasting 2011/01/06 02:06:48 Nit: |res| is a meaningless name; pick something m
dmazzoni 2011/01/06 15:03:03 Maybe EnableAccessibility would be a more clear na
oshima 2011/01/06 19:43:35 Done.
151
152 static AutocompleteEditView* Create(AutocompleteEditController* controller,
Peter Kasting 2011/01/06 02:06:48 Nit: A comment about what this function's responsi
dmazzoni 2011/01/06 15:03:03 What's the reason for adding a static Create metho
oshima 2011/01/06 19:43:35 Done.
oshima 2011/01/06 19:43:35 It will return either AutocompleteEditViewGtk or A
153 ToolbarModel* toolbar_model,
154 Profile* profile,
155 CommandUpdater* command_updater,
156 bool popup_window_mode,
157 const views::View* location_bar);
158 #else
159 int TextWidth() const;
Peter Kasting 2011/01/06 02:06:48 Nit: Since there's only one definition of this fun
oshima 2011/01/06 19:43:35 Done.
160 #endif
161
146 162
147 // Overridden from NotificationObserver: 163 // Overridden from NotificationObserver:
148 virtual void Observe(NotificationType type, 164 virtual void Observe(NotificationType type,
149 const NotificationSource& source, 165 const NotificationSource& source,
150 const NotificationDetails& details); 166 const NotificationDetails& details);
151 167
152 // Overridden from AnimationDelegate. 168 // Overridden from AnimationDelegate.
153 virtual void AnimationEnded(const Animation* animation); 169 virtual void AnimationEnded(const Animation* animation);
154 virtual void AnimationProgressed(const Animation* animation); 170 virtual void AnimationProgressed(const Animation* animation);
155 virtual void AnimationCanceled(const Animation* animation); 171 virtual void AnimationCanceled(const Animation* animation);
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
507 // track preedit_'s content, as it'll be treated as part of text content. 523 // track preedit_'s content, as it'll be treated as part of text content.
508 size_t preedit_size_before_change_; 524 size_t preedit_size_before_change_;
509 #endif 525 #endif
510 526
511 // The view that is going to be focused next. Only valid while handling 527 // The view that is going to be focused next. Only valid while handling
512 // "focus-out" events. 528 // "focus-out" events.
513 GtkWidget* going_to_focus_; 529 GtkWidget* going_to_focus_;
514 530
515 GtkSignalRegistrar signals_; 531 GtkSignalRegistrar signals_;
516 532
533 #if defined(TOOLKIT_VIEWS)
534 scoped_ptr<AccessibleWidgetHelper> accessible_widget_helper_;
535 #endif
536
517 DISALLOW_COPY_AND_ASSIGN(AutocompleteEditViewGtk); 537 DISALLOW_COPY_AND_ASSIGN(AutocompleteEditViewGtk);
518 }; 538 };
519 539
520 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_EDIT_VIEW_GTK_H_ 540 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_EDIT_VIEW_GTK_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698