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 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" | 5 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" |
6 | 6 |
7 #if defined(TOOLKIT_USES_GTK) | 7 #if defined(TOOLKIT_USES_GTK) |
8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
9 #endif | 9 #endif |
10 | 10 |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 // LocationBarView ----------------------------------------------------------- | 111 // LocationBarView ----------------------------------------------------------- |
112 | 112 |
113 LocationBarView::LocationBarView(Browser* browser, | 113 LocationBarView::LocationBarView(Browser* browser, |
114 ToolbarModel* model, | 114 ToolbarModel* model, |
115 Delegate* delegate, | 115 Delegate* delegate, |
116 Mode mode) | 116 Mode mode) |
117 : browser_(browser), | 117 : browser_(browser), |
118 model_(model), | 118 model_(model), |
119 delegate_(delegate), | 119 delegate_(delegate), |
120 disposition_(CURRENT_TAB), | 120 disposition_(CURRENT_TAB), |
121 transition_(PageTransition::TYPED | PageTransition::FROM_ADDRESS_BAR), | 121 transition_(content::PageTransitionFromInt( |
| 122 content::PAGE_TRANSITION_TYPED | |
| 123 content::PAGE_TRANSITION_FROM_ADDRESS_BAR)), |
122 location_icon_view_(NULL), | 124 location_icon_view_(NULL), |
123 ev_bubble_view_(NULL), | 125 ev_bubble_view_(NULL), |
124 location_entry_view_(NULL), | 126 location_entry_view_(NULL), |
125 selected_keyword_view_(NULL), | 127 selected_keyword_view_(NULL), |
126 #if defined(OS_WIN) | 128 #if defined(OS_WIN) |
127 suggested_text_view_(NULL), | 129 suggested_text_view_(NULL), |
128 #endif | 130 #endif |
129 keyword_hint_view_(NULL), | 131 keyword_hint_view_(NULL), |
130 star_view_(NULL), | 132 star_view_(NULL), |
131 mode_(mode), | 133 mode_(mode), |
(...skipping 685 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
817 if (views::Widget::IsPureViews()) | 819 if (views::Widget::IsPureViews()) |
818 NOTIMPLEMENTED(); | 820 NOTIMPLEMENTED(); |
819 else | 821 else |
820 GetOmniboxViewWin()->HandleExternalMsg(WM_CAPTURECHANGED, 0, CPoint()); | 822 GetOmniboxViewWin()->HandleExternalMsg(WM_CAPTURECHANGED, 0, CPoint()); |
821 } | 823 } |
822 #endif | 824 #endif |
823 | 825 |
824 void LocationBarView::OnAutocompleteAccept( | 826 void LocationBarView::OnAutocompleteAccept( |
825 const GURL& url, | 827 const GURL& url, |
826 WindowOpenDisposition disposition, | 828 WindowOpenDisposition disposition, |
827 PageTransition::Type transition, | 829 content::PageTransition transition, |
828 const GURL& alternate_nav_url) { | 830 const GURL& alternate_nav_url) { |
829 // WARNING: don't add an early return here. The calls after the if must | 831 // WARNING: don't add an early return here. The calls after the if must |
830 // happen. | 832 // happen. |
831 if (url.is_valid()) { | 833 if (url.is_valid()) { |
832 location_input_ = UTF8ToUTF16(url.spec()); | 834 location_input_ = UTF8ToUTF16(url.spec()); |
833 disposition_ = disposition; | 835 disposition_ = disposition; |
834 transition_ = transition | PageTransition::FROM_ADDRESS_BAR; | 836 transition_ = content::PageTransitionFromInt( |
| 837 transition | content::PAGE_TRANSITION_FROM_ADDRESS_BAR); |
835 | 838 |
836 if (browser_->command_updater()) { | 839 if (browser_->command_updater()) { |
837 if (!alternate_nav_url.is_valid()) { | 840 if (!alternate_nav_url.is_valid()) { |
838 browser_->command_updater()->ExecuteCommand(IDC_OPEN_CURRENT_URL); | 841 browser_->command_updater()->ExecuteCommand(IDC_OPEN_CURRENT_URL); |
839 } else { | 842 } else { |
840 AlternateNavURLFetcher* fetcher = | 843 AlternateNavURLFetcher* fetcher = |
841 new AlternateNavURLFetcher(alternate_nav_url); | 844 new AlternateNavURLFetcher(alternate_nav_url); |
842 // The AlternateNavURLFetcher will listen for the pending navigation | 845 // The AlternateNavURLFetcher will listen for the pending navigation |
843 // notification that will be issued as a result of the "open URL." It | 846 // notification that will be issued as a result of the "open URL." It |
844 // will automatically install itself into that navigation controller. | 847 // will automatically install itself into that navigation controller. |
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1149 } | 1152 } |
1150 | 1153 |
1151 string16 LocationBarView::GetInputString() const { | 1154 string16 LocationBarView::GetInputString() const { |
1152 return location_input_; | 1155 return location_input_; |
1153 } | 1156 } |
1154 | 1157 |
1155 WindowOpenDisposition LocationBarView::GetWindowOpenDisposition() const { | 1158 WindowOpenDisposition LocationBarView::GetWindowOpenDisposition() const { |
1156 return disposition_; | 1159 return disposition_; |
1157 } | 1160 } |
1158 | 1161 |
1159 PageTransition::Type LocationBarView::GetPageTransition() const { | 1162 content::PageTransition LocationBarView::GetPageTransition() const { |
1160 return transition_; | 1163 return transition_; |
1161 } | 1164 } |
1162 | 1165 |
1163 void LocationBarView::AcceptInput() { | 1166 void LocationBarView::AcceptInput() { |
1164 location_entry_->model()->AcceptInput(CURRENT_TAB, false); | 1167 location_entry_->model()->AcceptInput(CURRENT_TAB, false); |
1165 } | 1168 } |
1166 | 1169 |
1167 void LocationBarView::FocusLocation(bool select_all) { | 1170 void LocationBarView::FocusLocation(bool select_all) { |
1168 location_entry_->SetFocus(); | 1171 location_entry_->SetFocus(); |
1169 if (select_all) | 1172 if (select_all) |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1273 !suggested_text_view_->GetText().empty(); | 1276 !suggested_text_view_->GetText().empty(); |
1274 } | 1277 } |
1275 | 1278 |
1276 #if !defined(USE_AURA) | 1279 #if !defined(USE_AURA) |
1277 OmniboxViewWin* LocationBarView::GetOmniboxViewWin() { | 1280 OmniboxViewWin* LocationBarView::GetOmniboxViewWin() { |
1278 CHECK(!views::Widget::IsPureViews()); | 1281 CHECK(!views::Widget::IsPureViews()); |
1279 return static_cast<OmniboxViewWin*>(location_entry_.get()); | 1282 return static_cast<OmniboxViewWin*>(location_entry_.get()); |
1280 } | 1283 } |
1281 #endif | 1284 #endif |
1282 #endif | 1285 #endif |
OLD | NEW |