OLD | NEW |
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/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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 IDR_LOCATION_BAR_SELECTED_KEYWORD_BACKGROUND_R, | 108 IDR_LOCATION_BAR_SELECTED_KEYWORD_BACKGROUND_R, |
109 }; | 109 }; |
110 | 110 |
111 // Height of the location bar's round corner region. | 111 // Height of the location bar's round corner region. |
112 static const int kBorderRoundCornerHeight = 6; | 112 static const int kBorderRoundCornerHeight = 6; |
113 // Width of location bar's round corner region. | 113 // Width of location bar's round corner region. |
114 static const int kBorderRoundCornerWidth = 5; | 114 static const int kBorderRoundCornerWidth = 5; |
115 | 115 |
116 // LocationBarView ----------------------------------------------------------- | 116 // LocationBarView ----------------------------------------------------------- |
117 | 117 |
118 LocationBarView::LocationBarView(Browser* browser, | 118 LocationBarView::LocationBarView(Profile* profile, |
| 119 CommandUpdater* command_updater, |
119 ToolbarModel* model, | 120 ToolbarModel* model, |
120 Delegate* delegate, | 121 Delegate* delegate, |
121 Mode mode) | 122 Mode mode) |
122 : browser_(browser), | 123 : profile_(profile), |
| 124 command_updater_(command_updater), |
| 125 browser_(NULL), |
123 model_(model), | 126 model_(model), |
124 delegate_(delegate), | 127 delegate_(delegate), |
125 disposition_(CURRENT_TAB), | 128 disposition_(CURRENT_TAB), |
126 transition_(content::PageTransitionFromInt( | 129 transition_(content::PageTransitionFromInt( |
127 content::PAGE_TRANSITION_TYPED | | 130 content::PAGE_TRANSITION_TYPED | |
128 content::PAGE_TRANSITION_FROM_ADDRESS_BAR)), | 131 content::PAGE_TRANSITION_FROM_ADDRESS_BAR)), |
129 location_icon_view_(NULL), | 132 location_icon_view_(NULL), |
130 ev_bubble_view_(NULL), | 133 ev_bubble_view_(NULL), |
131 location_entry_view_(NULL), | 134 location_entry_view_(NULL), |
132 selected_keyword_view_(NULL), | 135 selected_keyword_view_(NULL), |
(...skipping 12 matching lines...) Expand all Loading... |
145 painter_.reset( | 148 painter_.reset( |
146 views::Painter::CreateImagePainter( | 149 views::Painter::CreateImagePainter( |
147 *ResourceBundle::GetSharedInstance().GetImageNamed( | 150 *ResourceBundle::GetSharedInstance().GetImageNamed( |
148 IDR_LOCATION_BAR_BORDER).ToSkBitmap(), | 151 IDR_LOCATION_BAR_BORDER).ToSkBitmap(), |
149 gfx::Insets(kBorderRoundCornerHeight, kBorderRoundCornerWidth, | 152 gfx::Insets(kBorderRoundCornerHeight, kBorderRoundCornerWidth, |
150 kBorderRoundCornerHeight, kBorderRoundCornerWidth), | 153 kBorderRoundCornerHeight, kBorderRoundCornerWidth), |
151 true)); | 154 true)); |
152 } | 155 } |
153 | 156 |
154 edit_bookmarks_enabled_.Init(prefs::kEditBookmarksEnabled, | 157 edit_bookmarks_enabled_.Init(prefs::kEditBookmarksEnabled, |
155 browser_->profile()->GetPrefs(), this); | 158 profile_->GetPrefs(), this); |
156 } | 159 } |
157 | 160 |
158 LocationBarView::~LocationBarView() { | 161 LocationBarView::~LocationBarView() { |
159 if (template_url_service_) | 162 if (template_url_service_) |
160 template_url_service_->RemoveObserver(this); | 163 template_url_service_->RemoveObserver(this); |
161 } | 164 } |
162 | 165 |
163 void LocationBarView::Init() { | 166 void LocationBarView::Init() { |
164 if (mode_ == POPUP) { | 167 if (mode_ == POPUP) { |
165 font_ = ResourceBundle::GetSharedInstance().GetFont( | 168 font_ = ResourceBundle::GetSharedInstance().GetFont( |
(...skipping 17 matching lines...) Expand all Loading... |
183 | 186 |
184 ev_bubble_view_ = | 187 ev_bubble_view_ = |
185 new EVBubbleView(kEVBubbleBackgroundImages, IDR_OMNIBOX_HTTPS_VALID, | 188 new EVBubbleView(kEVBubbleBackgroundImages, IDR_OMNIBOX_HTTPS_VALID, |
186 GetColor(ToolbarModel::EV_SECURE, SECURITY_TEXT), this); | 189 GetColor(ToolbarModel::EV_SECURE, SECURITY_TEXT), this); |
187 AddChildView(ev_bubble_view_); | 190 AddChildView(ev_bubble_view_); |
188 ev_bubble_view_->SetVisible(false); | 191 ev_bubble_view_->SetVisible(false); |
189 ev_bubble_view_->set_drag_controller(this); | 192 ev_bubble_view_->set_drag_controller(this); |
190 | 193 |
191 // URL edit field. | 194 // URL edit field. |
192 // View container for URL edit field. | 195 // View container for URL edit field. |
193 Profile* profile = browser_->profile(); | |
194 location_entry_.reset(OmniboxView::CreateOmniboxView( | 196 location_entry_.reset(OmniboxView::CreateOmniboxView( |
195 this, | 197 this, |
196 model_, | 198 model_, |
197 profile, | 199 profile_, |
198 browser_->command_updater(), | 200 command_updater_, |
199 mode_ == POPUP, | 201 mode_ == POPUP, |
200 this)); | 202 this)); |
201 SetLocationEntryFocusable(true); | 203 SetLocationEntryFocusable(true); |
202 | 204 |
203 location_entry_view_ = location_entry_->AddToView(this); | 205 location_entry_view_ = location_entry_->AddToView(this); |
204 location_entry_view_->set_id(VIEW_ID_AUTOCOMPLETE); | 206 location_entry_view_->set_id(VIEW_ID_AUTOCOMPLETE); |
205 | 207 |
206 selected_keyword_view_ = new SelectedKeywordView( | 208 selected_keyword_view_ = new SelectedKeywordView( |
207 kSelectedKeywordBackgroundImages, IDR_KEYWORD_SEARCH_MAGNIFIER, | 209 kSelectedKeywordBackgroundImages, IDR_KEYWORD_SEARCH_MAGNIFIER, |
208 GetColor(ToolbarModel::NONE, TEXT), profile); | 210 GetColor(ToolbarModel::NONE, TEXT), profile_); |
209 AddChildView(selected_keyword_view_); | 211 AddChildView(selected_keyword_view_); |
210 selected_keyword_view_->SetFont(font_); | 212 selected_keyword_view_->SetFont(font_); |
211 selected_keyword_view_->SetVisible(false); | 213 selected_keyword_view_->SetVisible(false); |
212 | 214 |
213 keyword_hint_view_ = new KeywordHintView(profile); | 215 keyword_hint_view_ = new KeywordHintView(profile_); |
214 AddChildView(keyword_hint_view_); | 216 AddChildView(keyword_hint_view_); |
215 keyword_hint_view_->SetVisible(false); | 217 keyword_hint_view_->SetVisible(false); |
216 keyword_hint_view_->SetFont(font_); | 218 keyword_hint_view_->SetFont(font_); |
217 | 219 |
218 for (int i = 0; i < CONTENT_SETTINGS_NUM_TYPES; ++i) { | 220 for (int i = 0; i < CONTENT_SETTINGS_NUM_TYPES; ++i) { |
219 ContentSettingImageView* content_blocked_view = | 221 ContentSettingImageView* content_blocked_view = |
220 new ContentSettingImageView(static_cast<ContentSettingsType>(i), this); | 222 new ContentSettingImageView(static_cast<ContentSettingsType>(i), this); |
221 content_setting_views_.push_back(content_blocked_view); | 223 content_setting_views_.push_back(content_blocked_view); |
222 AddChildView(content_blocked_view); | 224 AddChildView(content_blocked_view); |
223 content_blocked_view->SetVisible(false); | 225 content_blocked_view->SetVisible(false); |
224 } | 226 } |
225 | 227 |
226 // The star is not visible in popups and in the app launcher. | 228 // The star is not visible in popups and in the app launcher. |
227 if (browser_defaults::bookmarks_enabled && (mode_ == NORMAL)) { | 229 if (browser_defaults::bookmarks_enabled && (mode_ == NORMAL)) { |
228 star_view_ = new StarView(browser_->command_updater()); | 230 star_view_ = new StarView(command_updater_); |
229 AddChildView(star_view_); | 231 AddChildView(star_view_); |
230 star_view_->SetVisible(true); | 232 star_view_->SetVisible(true); |
231 } | 233 } |
232 | 234 |
233 // Initialize the location entry. We do this to avoid a black flash which is | 235 // Initialize the location entry. We do this to avoid a black flash which is |
234 // visible when the location entry has just been initialized. | 236 // visible when the location entry has just been initialized. |
235 Update(NULL); | 237 Update(NULL); |
236 | 238 |
237 OnChanged(); | 239 OnChanged(); |
238 } | 240 } |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 FocusLocation(select_all); | 297 FocusLocation(select_all); |
296 } | 298 } |
297 | 299 |
298 void LocationBarView::SetAnimationOffset(int offset) { | 300 void LocationBarView::SetAnimationOffset(int offset) { |
299 animation_offset_ = offset; | 301 animation_offset_ = offset; |
300 } | 302 } |
301 | 303 |
302 void LocationBarView::Update(const WebContents* tab_for_state_restoring) { | 304 void LocationBarView::Update(const WebContents* tab_for_state_restoring) { |
303 bool star_enabled = star_view_ && !model_->input_in_progress() && | 305 bool star_enabled = star_view_ && !model_->input_in_progress() && |
304 edit_bookmarks_enabled_.GetValue(); | 306 edit_bookmarks_enabled_.GetValue(); |
305 browser_->command_updater()->UpdateCommandEnabled( | 307 command_updater_->UpdateCommandEnabled( |
306 IDC_BOOKMARK_PAGE, star_enabled); | 308 IDC_BOOKMARK_PAGE, star_enabled); |
307 if (star_view_) | 309 if (star_view_) |
308 star_view_->SetVisible(star_enabled); | 310 star_view_->SetVisible(star_enabled); |
309 RefreshContentSettingViews(); | 311 RefreshContentSettingViews(); |
310 RefreshPageActionViews(); | 312 RefreshPageActionViews(); |
311 // Don't Update in app launcher mode so that the location entry does not show | 313 // Don't Update in app launcher mode so that the location entry does not show |
312 // a URL or security background. | 314 // a URL or security background. |
313 if (mode_ != APP_LAUNCHER) | 315 if (mode_ != APP_LAUNCHER) |
314 location_entry_->Update(tab_for_state_restoring); | 316 location_entry_->Update(tab_for_state_restoring); |
315 OnChanged(); | 317 OnChanged(); |
316 } | 318 } |
317 | 319 |
| 320 Browser* LocationBarView::FindBrowser() { |
| 321 if (!browser_ && delegate_->GetTabContentsWrapper()) { |
| 322 WebContents* tab = delegate_->GetTabContentsWrapper()->web_contents(); |
| 323 browser_ = Browser::GetBrowserForController(&tab->GetController(), NULL); |
| 324 } |
| 325 return browser_; |
| 326 } |
| 327 |
318 void LocationBarView::UpdateContentSettingsIcons() { | 328 void LocationBarView::UpdateContentSettingsIcons() { |
319 RefreshContentSettingViews(); | 329 RefreshContentSettingViews(); |
320 | 330 |
321 Layout(); | 331 Layout(); |
322 SchedulePaint(); | 332 SchedulePaint(); |
323 } | 333 } |
324 | 334 |
325 void LocationBarView::UpdatePageActions() { | 335 void LocationBarView::UpdatePageActions() { |
326 size_t count_before = page_action_views_.size(); | 336 size_t count_before = page_action_views_.size(); |
327 RefreshPageActionViews(); | 337 RefreshPageActionViews(); |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
391 } | 401 } |
392 return NULL; | 402 return NULL; |
393 } | 403 } |
394 | 404 |
395 void LocationBarView::SetStarToggled(bool on) { | 405 void LocationBarView::SetStarToggled(bool on) { |
396 if (star_view_) | 406 if (star_view_) |
397 star_view_->SetToggled(on); | 407 star_view_->SetToggled(on); |
398 } | 408 } |
399 | 409 |
400 void LocationBarView::ShowStarBubble(const GURL& url, bool newly_bookmarked) { | 410 void LocationBarView::ShowStarBubble(const GURL& url, bool newly_bookmarked) { |
401 browser::ShowBookmarkBubbleView(star_view_, browser_->profile(), url, | 411 browser::ShowBookmarkBubbleView(star_view_, profile_, url, |
402 newly_bookmarked); | 412 newly_bookmarked); |
403 } | 413 } |
404 | 414 |
405 gfx::Point LocationBarView::GetLocationEntryOrigin() const { | 415 gfx::Point LocationBarView::GetLocationEntryOrigin() const { |
406 gfx::Point origin(location_entry_view_->bounds().origin()); | 416 gfx::Point origin(location_entry_view_->bounds().origin()); |
407 // If the UI layout is RTL, the coordinate system is not transformed and | 417 // If the UI layout is RTL, the coordinate system is not transformed and |
408 // therefore we need to adjust the X coordinate so that bubble appears on the | 418 // therefore we need to adjust the X coordinate so that bubble appears on the |
409 // right hand side of the location bar. | 419 // right hand side of the location bar. |
410 if (base::i18n::IsRTL()) | 420 if (base::i18n::IsRTL()) |
411 origin.set_x(width() - origin.x()); | 421 origin.set_x(width() - origin.x()); |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
557 if (max_edit_width < 0) | 567 if (max_edit_width < 0) |
558 return; | 568 return; |
559 const int available_width = AvailableWidth(max_edit_width); | 569 const int available_width = AvailableWidth(max_edit_width); |
560 | 570 |
561 const bool show_keyword_hint = !keyword.empty() && is_keyword_hint; | 571 const bool show_keyword_hint = !keyword.empty() && is_keyword_hint; |
562 selected_keyword_view_->SetVisible(show_selected_keyword); | 572 selected_keyword_view_->SetVisible(show_selected_keyword); |
563 keyword_hint_view_->SetVisible(show_keyword_hint); | 573 keyword_hint_view_->SetVisible(show_keyword_hint); |
564 if (show_selected_keyword) { | 574 if (show_selected_keyword) { |
565 if (selected_keyword_view_->keyword() != keyword) { | 575 if (selected_keyword_view_->keyword() != keyword) { |
566 selected_keyword_view_->SetKeyword(keyword); | 576 selected_keyword_view_->SetKeyword(keyword); |
567 Profile* profile = browser_->profile(); | |
568 const TemplateURL* template_url = | 577 const TemplateURL* template_url = |
569 TemplateURLServiceFactory::GetForProfile(profile)-> | 578 TemplateURLServiceFactory::GetForProfile(profile_)-> |
570 GetTemplateURLForKeyword(keyword); | 579 GetTemplateURLForKeyword(keyword); |
571 if (template_url && template_url->IsExtensionKeyword()) { | 580 if (template_url && template_url->IsExtensionKeyword()) { |
572 const SkBitmap& bitmap = profile->GetExtensionService()->GetOmniboxIcon( | 581 const SkBitmap& bitmap = |
573 template_url->GetExtensionId()); | 582 profile_->GetExtensionService()->GetOmniboxIcon( |
| 583 template_url->GetExtensionId()); |
574 selected_keyword_view_->SetImage(bitmap); | 584 selected_keyword_view_->SetImage(bitmap); |
575 selected_keyword_view_->set_is_extension_icon(true); | 585 selected_keyword_view_->set_is_extension_icon(true); |
576 } else { | 586 } else { |
577 selected_keyword_view_->SetImage(*ResourceBundle::GetSharedInstance(). | 587 selected_keyword_view_->SetImage(*ResourceBundle::GetSharedInstance(). |
578 GetBitmapNamed(IDR_OMNIBOX_SEARCH)); | 588 GetBitmapNamed(IDR_OMNIBOX_SEARCH)); |
579 selected_keyword_view_->set_is_extension_icon(false); | 589 selected_keyword_view_->set_is_extension_icon(false); |
580 } | 590 } |
581 } | 591 } |
582 } else if (show_keyword_hint) { | 592 } else if (show_keyword_hint) { |
583 if (keyword_hint_view_->keyword() != keyword) | 593 if (keyword_hint_view_->keyword() != keyword) |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
811 content::PageTransition transition, | 821 content::PageTransition transition, |
812 const GURL& alternate_nav_url) { | 822 const GURL& alternate_nav_url) { |
813 // WARNING: don't add an early return here. The calls after the if must | 823 // WARNING: don't add an early return here. The calls after the if must |
814 // happen. | 824 // happen. |
815 if (url.is_valid()) { | 825 if (url.is_valid()) { |
816 location_input_ = UTF8ToUTF16(url.spec()); | 826 location_input_ = UTF8ToUTF16(url.spec()); |
817 disposition_ = disposition; | 827 disposition_ = disposition; |
818 transition_ = content::PageTransitionFromInt( | 828 transition_ = content::PageTransitionFromInt( |
819 transition | content::PAGE_TRANSITION_FROM_ADDRESS_BAR); | 829 transition | content::PAGE_TRANSITION_FROM_ADDRESS_BAR); |
820 | 830 |
821 if (browser_->command_updater()) { | 831 if (command_updater_) { |
822 if (!alternate_nav_url.is_valid()) { | 832 if (!alternate_nav_url.is_valid()) { |
823 browser_->command_updater()->ExecuteCommand(IDC_OPEN_CURRENT_URL); | 833 command_updater_->ExecuteCommand(IDC_OPEN_CURRENT_URL); |
824 } else { | 834 } else { |
825 AlternateNavURLFetcher* fetcher = | 835 AlternateNavURLFetcher* fetcher = |
826 new AlternateNavURLFetcher(alternate_nav_url); | 836 new AlternateNavURLFetcher(alternate_nav_url); |
827 // The AlternateNavURLFetcher will listen for the pending navigation | 837 // The AlternateNavURLFetcher will listen for the pending navigation |
828 // notification that will be issued as a result of the "open URL." It | 838 // notification that will be issued as a result of the "open URL." It |
829 // will automatically install itself into that navigation controller. | 839 // will automatically install itself into that navigation controller. |
830 browser_->command_updater()->ExecuteCommand(IDC_OPEN_CURRENT_URL); | 840 command_updater_->ExecuteCommand(IDC_OPEN_CURRENT_URL); |
831 if (fetcher->state() == AlternateNavURLFetcher::NOT_STARTED) { | 841 if (fetcher->state() == AlternateNavURLFetcher::NOT_STARTED) { |
832 // I'm not sure this should be reachable, but I'm not also sure enough | 842 // I'm not sure this should be reachable, but I'm not also sure enough |
833 // that it shouldn't to stick in a NOTREACHED(). In any case, this is | 843 // that it shouldn't to stick in a NOTREACHED(). In any case, this is |
834 // harmless. | 844 // harmless. |
835 delete fetcher; | 845 delete fetcher; |
836 } else { | 846 } else { |
837 // The navigation controller will delete the fetcher. | 847 // The navigation controller will delete the fetcher. |
838 } | 848 } |
839 } | 849 } |
840 } | 850 } |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
927 for (PageActionViews::const_iterator i(page_action_views_.begin()); | 937 for (PageActionViews::const_iterator i(page_action_views_.begin()); |
928 i != page_action_views_.end(); ++i) | 938 i != page_action_views_.end(); ++i) |
929 RemoveChildView(*i); | 939 RemoveChildView(*i); |
930 STLDeleteElements(&page_action_views_); | 940 STLDeleteElements(&page_action_views_); |
931 } | 941 } |
932 | 942 |
933 void LocationBarView::RefreshPageActionViews() { | 943 void LocationBarView::RefreshPageActionViews() { |
934 if (mode_ != NORMAL) | 944 if (mode_ != NORMAL) |
935 return; | 945 return; |
936 | 946 |
937 ExtensionService* service = browser_->profile()->GetExtensionService(); | 947 ExtensionService* service = profile_->GetExtensionService(); |
938 if (!service) | 948 if (!service) |
939 return; | 949 return; |
940 | 950 |
941 std::map<ExtensionAction*, bool> old_visibility; | 951 std::map<ExtensionAction*, bool> old_visibility; |
942 for (PageActionViews::const_iterator i(page_action_views_.begin()); | 952 for (PageActionViews::const_iterator i(page_action_views_.begin()); |
943 i != page_action_views_.end(); ++i) | 953 i != page_action_views_.end(); ++i) |
944 old_visibility[(*i)->image_view()->page_action()] = (*i)->visible(); | 954 old_visibility[(*i)->image_view()->page_action()] = (*i)->visible(); |
945 | 955 |
946 // Remember the previous visibility of the page actions so that we can | 956 // Remember the previous visibility of the page actions so that we can |
947 // notify when this changes. | 957 // notify when this changes. |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
999 if (views::Widget::IsPureViews()) | 1009 if (views::Widget::IsPureViews()) |
1000 NOTIMPLEMENTED(); | 1010 NOTIMPLEMENTED(); |
1001 else | 1011 else |
1002 GetOmniboxViewWin()->HandleExternalMsg(msg, flags, screen_point.ToPOINT()); | 1012 GetOmniboxViewWin()->HandleExternalMsg(msg, flags, screen_point.ToPOINT()); |
1003 } | 1013 } |
1004 #endif | 1014 #endif |
1005 | 1015 |
1006 void LocationBarView::ShowFirstRunBubbleInternal() { | 1016 void LocationBarView::ShowFirstRunBubbleInternal() { |
1007 #if !defined(OS_CHROMEOS) | 1017 #if !defined(OS_CHROMEOS) |
1008 // First run bubble doesn't make sense for Chrome OS. | 1018 // First run bubble doesn't make sense for Chrome OS. |
1009 FirstRunBubble::ShowBubble(browser_->profile(), location_icon_view_); | 1019 FirstRunBubble::ShowBubble(profile_, location_icon_view_); |
1010 #endif | 1020 #endif |
1011 } | 1021 } |
1012 | 1022 |
1013 std::string LocationBarView::GetClassName() const { | 1023 std::string LocationBarView::GetClassName() const { |
1014 return kViewClassName; | 1024 return kViewClassName; |
1015 } | 1025 } |
1016 | 1026 |
1017 bool LocationBarView::SkipDefaultKeyEventProcessing( | 1027 bool LocationBarView::SkipDefaultKeyEventProcessing( |
1018 const views::KeyEvent& event) { | 1028 const views::KeyEvent& event) { |
1019 #if defined(OS_WIN) | 1029 #if defined(OS_WIN) |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1096 const gfx::Point& p) { | 1106 const gfx::Point& p) { |
1097 return true; | 1107 return true; |
1098 } | 1108 } |
1099 | 1109 |
1100 //////////////////////////////////////////////////////////////////////////////// | 1110 //////////////////////////////////////////////////////////////////////////////// |
1101 // LocationBarView, LocationBar implementation: | 1111 // LocationBarView, LocationBar implementation: |
1102 | 1112 |
1103 void LocationBarView::ShowFirstRunBubble() { | 1113 void LocationBarView::ShowFirstRunBubble() { |
1104 // Wait until search engines have loaded to show the first run bubble. | 1114 // Wait until search engines have loaded to show the first run bubble. |
1105 TemplateURLService* url_service = | 1115 TemplateURLService* url_service = |
1106 TemplateURLServiceFactory::GetForProfile(browser_->profile()); | 1116 TemplateURLServiceFactory::GetForProfile(profile_); |
1107 if (!url_service->loaded()) { | 1117 if (!url_service->loaded()) { |
1108 template_url_service_ = url_service; | 1118 template_url_service_ = url_service; |
1109 template_url_service_->AddObserver(this); | 1119 template_url_service_->AddObserver(this); |
1110 template_url_service_->Load(); | 1120 template_url_service_->Load(); |
1111 return; | 1121 return; |
1112 } | 1122 } |
1113 ShowFirstRunBubbleInternal(); | 1123 ShowFirstRunBubbleInternal(); |
1114 } | 1124 } |
1115 | 1125 |
1116 void LocationBarView::SetSuggestedText(const string16& text, | 1126 void LocationBarView::SetSuggestedText(const string16& text, |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1243 !suggested_text_view_->GetText().empty(); | 1253 !suggested_text_view_->GetText().empty(); |
1244 } | 1254 } |
1245 | 1255 |
1246 #if !defined(USE_AURA) | 1256 #if !defined(USE_AURA) |
1247 OmniboxViewWin* LocationBarView::GetOmniboxViewWin() { | 1257 OmniboxViewWin* LocationBarView::GetOmniboxViewWin() { |
1248 CHECK(!views::Widget::IsPureViews()); | 1258 CHECK(!views::Widget::IsPureViews()); |
1249 return static_cast<OmniboxViewWin*>(location_entry_.get()); | 1259 return static_cast<OmniboxViewWin*>(location_entry_.get()); |
1250 } | 1260 } |
1251 #endif | 1261 #endif |
1252 #endif | 1262 #endif |
OLD | NEW |