| 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_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 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/scoped_ptr.h" | 12 #include "base/scoped_ptr.h" |
| 13 #include "chrome/browser/autocomplete/autocomplete_edit_view.h" | 13 #include "chrome/browser/autocomplete/autocomplete_edit_view.h" |
| 14 #include "chrome/browser/ui/toolbar/toolbar_model.h" | 14 #include "chrome/browser/ui/toolbar/toolbar_model.h" |
| 15 #include "chrome/common/notification_observer.h" | 15 #include "chrome/common/notification_observer.h" |
| 16 #include "chrome/common/page_transition_types.h" | 16 #include "chrome/common/page_transition_types.h" |
| 17 #include "views/controls/textfield/textfield.h" | 17 #include "views/controls/textfield/text_range.h" |
| 18 #include "views/controls/textfield/textfield_controller.h" |
| 18 #include "views/view.h" | 19 #include "views/view.h" |
| 19 #include "webkit/glue/window_open_disposition.h" | 20 #include "webkit/glue/window_open_disposition.h" |
| 20 | 21 |
| 21 class AutocompleteEditController; | 22 class AutocompleteEditController; |
| 22 class AutocompleteEditModel; | 23 class AutocompleteEditModel; |
| 23 class AutocompletePopupView; | 24 class AutocompletePopupView; |
| 24 class Profile; | 25 class Profile; |
| 25 class TabContents; | 26 class TabContents; |
| 26 | 27 |
| 27 // Views-implementation of AutocompleteEditView. This is based on | 28 // Views-implementation of AutocompleteEditView. This is based on |
| 28 // gtk implementation. The following features are not yet supported. | 29 // gtk implementation. The following features are not yet supported. |
| 29 // | 30 // |
| 30 // IME support. | 31 // IME support. |
| 31 // LTR support. | 32 // LTR support. |
| 32 // Selection behavior. | 33 // Selection behavior. |
| 33 // Cut,copy and paste behavior. | 34 // Cut,copy and paste behavior. |
| 34 // Drag and drop behavior. | 35 // Drag and drop behavior. |
| 35 // URL styles (strikestrough insecure scheme, emphasize host). | 36 // URL styles (strikestrough insecure scheme, emphasize host). |
| 36 // Custom context menu for omnibox. | 37 // Custom context menu for omnibox. |
| 37 // Instant. | 38 // Instant. |
| 38 class AutocompleteEditViewViews : public views::View, | 39 class AutocompleteEditViewViews : public views::View, |
| 39 public AutocompleteEditView, | 40 public AutocompleteEditView, |
| 40 public NotificationObserver, | 41 public NotificationObserver, |
| 41 public views::Textfield::Controller { | 42 public views::TextfieldController { |
| 42 public: | 43 public: |
| 43 AutocompleteEditViewViews(AutocompleteEditController* controller, | 44 AutocompleteEditViewViews(AutocompleteEditController* controller, |
| 44 ToolbarModel* toolbar_model, | 45 ToolbarModel* toolbar_model, |
| 45 Profile* profile, | 46 Profile* profile, |
| 46 CommandUpdater* command_updater, | 47 CommandUpdater* command_updater, |
| 47 bool popup_window_mode, | 48 bool popup_window_mode, |
| 48 const views::View* location_bar); | 49 const views::View* location_bar); |
| 49 virtual ~AutocompleteEditViewViews(); | 50 virtual ~AutocompleteEditViewViews(); |
| 50 | 51 |
| 51 // Initialize, create the underlying views, etc; | 52 // Initialize, create the underlying views, etc; |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 virtual bool OnAfterPossibleChange(); | 113 virtual bool OnAfterPossibleChange(); |
| 113 virtual gfx::NativeView GetNativeView() const; | 114 virtual gfx::NativeView GetNativeView() const; |
| 114 virtual CommandUpdater* GetCommandUpdater(); | 115 virtual CommandUpdater* GetCommandUpdater(); |
| 115 virtual void SetInstantSuggestion(const string16& input); | 116 virtual void SetInstantSuggestion(const string16& input); |
| 116 virtual string16 GetInstantSuggestion() const; | 117 virtual string16 GetInstantSuggestion() const; |
| 117 virtual int TextWidth() const; | 118 virtual int TextWidth() const; |
| 118 virtual bool IsImeComposing() const; | 119 virtual bool IsImeComposing() const; |
| 119 virtual views::View* AddToView(views::View* parent); | 120 virtual views::View* AddToView(views::View* parent); |
| 120 virtual int OnPerformDrop(const views::DropTargetEvent& event); | 121 virtual int OnPerformDrop(const views::DropTargetEvent& event); |
| 121 | 122 |
| 122 // Overridden from NotificationObserver: | 123 // NotificationObserver: |
| 123 virtual void Observe(NotificationType type, | 124 virtual void Observe(NotificationType type, |
| 124 const NotificationSource& source, | 125 const NotificationSource& source, |
| 125 const NotificationDetails& details); | 126 const NotificationDetails& details); |
| 126 | 127 |
| 127 // Overridden from Textfield::Controller | 128 // views::TextfieldController: |
| 128 virtual void ContentsChanged(views::Textfield* sender, | 129 virtual void ContentsChanged(views::Textfield* sender, |
| 129 const string16& new_contents); | 130 const string16& new_contents); |
| 130 virtual bool HandleKeyEvent(views::Textfield* sender, | 131 virtual bool HandleKeyEvent(views::Textfield* sender, |
| 131 const views::KeyEvent& key_event); | 132 const views::KeyEvent& key_event); |
| 132 | 133 |
| 133 private: | 134 private: |
| 134 // Return the number of characers in the current buffer. | 135 // Return the number of characers in the current buffer. |
| 135 size_t GetTextLength() const; | 136 size_t GetTextLength() const; |
| 136 | 137 |
| 137 // Try to parse the current text as a URL and colorize the components. | 138 // Try to parse the current text as a URL and colorize the components. |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 // This flag should be set for changes directly caused by a key press event, | 202 // This flag should be set for changes directly caused by a key press event, |
| 202 // including changes to content text, selection range and preedit string. | 203 // including changes to content text, selection range and preedit string. |
| 203 // Changes caused by function calls like SetUserText() should not affect this | 204 // Changes caused by function calls like SetUserText() should not affect this |
| 204 // flag. | 205 // flag. |
| 205 bool content_maybe_changed_by_key_press_; | 206 bool content_maybe_changed_by_key_press_; |
| 206 | 207 |
| 207 DISALLOW_COPY_AND_ASSIGN(AutocompleteEditViewViews); | 208 DISALLOW_COPY_AND_ASSIGN(AutocompleteEditViewViews); |
| 208 }; | 209 }; |
| 209 | 210 |
| 210 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_EDIT_VIEW_VIEWS_H_ | 211 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_EDIT_VIEW_VIEWS_H_ |
| OLD | NEW |