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

Side by Side Diff: chrome/browser/ui/views/omnibox/omnibox_view_views.cc

Issue 10534153: Use OmniboxViewViews on Win with --enable-views-textfield. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Ignore Patch Set 3; use static bool in UseOmniboxViews(). Created 8 years, 6 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #include "chrome/browser/ui/views/omnibox/omnibox_view_views.h" 5 #include "chrome/browser/ui/views/omnibox/omnibox_view_views.h"
6 6
7 #include "base/property_bag.h" 7 #include "base/property_bag.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 29 matching lines...) Expand all
40 #include "ui/views/events/event.h" 40 #include "ui/views/events/event.h"
41 #include "ui/views/ime/input_method.h" 41 #include "ui/views/ime/input_method.h"
42 #include "ui/views/layout/fill_layout.h" 42 #include "ui/views/layout/fill_layout.h"
43 #include "ui/views/views_delegate.h" 43 #include "ui/views/views_delegate.h"
44 44
45 #if defined(USE_AURA) 45 #if defined(USE_AURA)
46 #include "ui/aura/focus_manager.h" 46 #include "ui/aura/focus_manager.h"
47 #include "ui/aura/root_window.h" 47 #include "ui/aura/root_window.h"
48 #endif 48 #endif
49 49
50 #if defined(OS_WIN)
51 #include "chrome/browser/ui/views/omnibox/omnibox_view_win.h"
52 #endif
53
54 using content::WebContents; 50 using content::WebContents;
55 51
56 namespace { 52 namespace {
57 53
58 // Textfield for autocomplete that intercepts events that are necessary 54 // Textfield for autocomplete that intercepts events that are necessary
59 // for OmniboxViewViews. 55 // for OmniboxViewViews.
60 class AutocompleteTextfield : public views::Textfield { 56 class AutocompleteTextfield : public views::Textfield {
61 public: 57 public:
62 explicit AutocompleteTextfield(OmniboxViewViews* omnibox_view) 58 explicit AutocompleteTextfield(OmniboxViewViews* omnibox_view)
63 : views::Textfield(views::Textfield::STYLE_DEFAULT), 59 : views::Textfield(views::Textfield::STYLE_DEFAULT),
(...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after
665 model_->OnChanged(); 661 model_->OnChanged();
666 662
667 return something_changed; 663 return something_changed;
668 } 664 }
669 665
670 gfx::NativeView OmniboxViewViews::GetNativeView() const { 666 gfx::NativeView OmniboxViewViews::GetNativeView() const {
671 return GetWidget()->GetNativeView(); 667 return GetWidget()->GetNativeView();
672 } 668 }
673 669
674 gfx::NativeView OmniboxViewViews::GetRelativeWindowForPopup() const { 670 gfx::NativeView OmniboxViewViews::GetRelativeWindowForPopup() const {
675 #if defined(OS_WIN) && !defined(USE_AURA)
676 return OmniboxViewWin::GetRelativeWindowForNativeView(GetNativeView());
677 #else
678 return GetWidget()->GetTopLevelWidget()->GetNativeView(); 671 return GetWidget()->GetTopLevelWidget()->GetNativeView();
679 #endif
680 } 672 }
681 673
682 CommandUpdater* OmniboxViewViews::GetCommandUpdater() { 674 CommandUpdater* OmniboxViewViews::GetCommandUpdater() {
683 return command_updater_; 675 return command_updater_;
684 } 676 }
685 677
686 void OmniboxViewViews::SetInstantSuggestion(const string16& input, 678 void OmniboxViewViews::SetInstantSuggestion(const string16& input,
687 bool animate_to_complete) { 679 bool animate_to_complete) {
688 #if defined(OS_WIN) || defined(USE_AURA) 680 #if defined(OS_WIN) || defined(USE_AURA)
689 location_bar_view_->SetInstantSuggestion(input, animate_to_complete); 681 location_bar_view_->SetInstantSuggestion(input, animate_to_complete);
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
893 const ui::Range& range) { 885 const ui::Range& range) {
894 if (text != GetText()) 886 if (text != GetText())
895 textfield_->SetText(text); 887 textfield_->SetText(text);
896 textfield_->SelectRange(range); 888 textfield_->SelectRange(range);
897 } 889 }
898 890
899 string16 OmniboxViewViews::GetSelectedText() const { 891 string16 OmniboxViewViews::GetSelectedText() const {
900 // TODO(oshima): Support instant, IME. 892 // TODO(oshima): Support instant, IME.
901 return textfield_->GetSelectedText(); 893 return textfield_->GetSelectedText();
902 } 894 }
903
904 #if defined(USE_AURA)
905 // static
906 OmniboxView* OmniboxView::CreateOmniboxView(
907 AutocompleteEditController* controller,
908 ToolbarModel* toolbar_model,
909 Profile* profile,
910 CommandUpdater* command_updater,
911 bool popup_window_mode,
912 LocationBarView* location_bar) {
913 OmniboxViewViews* omnibox_view = new OmniboxViewViews(controller,
914 toolbar_model,
915 profile,
916 command_updater,
917 popup_window_mode,
918 location_bar);
919 omnibox_view->Init();
920 return omnibox_view;
921 }
922 #endif
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/omnibox/omnibox_view_views.h ('k') | chrome/browser/ui/views/omnibox/omnibox_view_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698