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 #include <algorithm> | 7 #include <algorithm> |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
11 #include "base/stl_util.h" | 11 #include "base/stl_util.h" |
12 #include "base/utf_string_conversions.h" | 12 #include "base/utf_string_conversions.h" |
13 #include "chrome/app/chrome_command_ids.h" | 13 #include "chrome/app/chrome_command_ids.h" |
14 #include "chrome/browser/alternate_nav_url_fetcher.h" | 14 #include "chrome/browser/alternate_nav_url_fetcher.h" |
15 #include "chrome/browser/autocomplete/autocomplete_popup_model.h" | 15 #include "chrome/browser/autocomplete/autocomplete_popup_model.h" |
16 #include "chrome/browser/chrome_to_mobile_service.h" | 16 #include "chrome/browser/chrome_to_mobile_service.h" |
17 #include "chrome/browser/chrome_to_mobile_service_factory.h" | 17 #include "chrome/browser/chrome_to_mobile_service_factory.h" |
18 #include "chrome/browser/defaults.h" | 18 #include "chrome/browser/defaults.h" |
19 #include "chrome/browser/extensions/extension_browser_event_router.h" | 19 #include "chrome/browser/extensions/extension_browser_event_router.h" |
20 #include "chrome/browser/extensions/extension_service.h" | 20 #include "chrome/browser/extensions/extension_service.h" |
21 #include "chrome/browser/favicon/favicon_tab_helper.h" | 21 #include "chrome/browser/favicon/favicon_tab_helper.h" |
22 #include "chrome/browser/instant/instant_controller.h" | 22 #include "chrome/browser/instant/instant_controller.h" |
23 #include "chrome/browser/profiles/profile.h" | 23 #include "chrome/browser/profiles/profile.h" |
24 #include "chrome/browser/search_engines/template_url.h" | 24 #include "chrome/browser/search_engines/template_url.h" |
25 #include "chrome/browser/search_engines/template_url_service.h" | 25 #include "chrome/browser/search_engines/template_url_service.h" |
26 #include "chrome/browser/search_engines/template_url_service_factory.h" | 26 #include "chrome/browser/search_engines/template_url_service_factory.h" |
27 #include "chrome/browser/ui/browser.h" | 27 #include "chrome/browser/ui/browser.h" |
| 28 #include "chrome/browser/ui/browser_finder.h" |
28 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 29 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
29 #include "chrome/browser/ui/view_ids.h" | 30 #include "chrome/browser/ui/view_ids.h" |
30 #include "chrome/browser/ui/views/browser_dialogs.h" | 31 #include "chrome/browser/ui/views/browser_dialogs.h" |
31 #include "chrome/browser/ui/views/location_bar/chrome_to_mobile_view.h" | 32 #include "chrome/browser/ui/views/location_bar/chrome_to_mobile_view.h" |
32 #include "chrome/browser/ui/views/location_bar/content_setting_image_view.h" | 33 #include "chrome/browser/ui/views/location_bar/content_setting_image_view.h" |
33 #include "chrome/browser/ui/views/location_bar/ev_bubble_view.h" | 34 #include "chrome/browser/ui/views/location_bar/ev_bubble_view.h" |
34 #include "chrome/browser/ui/views/location_bar/keyword_hint_view.h" | 35 #include "chrome/browser/ui/views/location_bar/keyword_hint_view.h" |
35 #include "chrome/browser/ui/views/location_bar/location_icon_view.h" | 36 #include "chrome/browser/ui/views/location_bar/location_icon_view.h" |
36 #include "chrome/browser/ui/views/location_bar/page_action_image_view.h" | 37 #include "chrome/browser/ui/views/location_bar/page_action_image_view.h" |
37 #include "chrome/browser/ui/views/location_bar/page_action_with_badge_view.h" | 38 #include "chrome/browser/ui/views/location_bar/page_action_with_badge_view.h" |
(...skipping 974 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1012 page_action_views_[i] = new PageActionWithBadgeView( | 1013 page_action_views_[i] = new PageActionWithBadgeView( |
1013 delegate_->CreatePageActionImageView(this, page_actions[i])); | 1014 delegate_->CreatePageActionImageView(this, page_actions[i])); |
1014 page_action_views_[i]->SetVisible(false); | 1015 page_action_views_[i]->SetVisible(false); |
1015 AddChildViewAt(page_action_views_[i], GetIndexOf(view)); | 1016 AddChildViewAt(page_action_views_[i], GetIndexOf(view)); |
1016 } | 1017 } |
1017 } | 1018 } |
1018 | 1019 |
1019 WebContents* contents = GetWebContentsFromDelegate(delegate_); | 1020 WebContents* contents = GetWebContentsFromDelegate(delegate_); |
1020 if (!page_action_views_.empty() && contents) { | 1021 if (!page_action_views_.empty() && contents) { |
1021 Browser* browser = | 1022 Browser* browser = |
1022 Browser::GetBrowserForController(&contents->GetController(), NULL); | 1023 browser::FindBrowserForController(&contents->GetController(), NULL); |
1023 GURL url = browser->GetSelectedWebContents()->GetURL(); | 1024 GURL url = browser->GetSelectedWebContents()->GetURL(); |
1024 | 1025 |
1025 for (PageActionViews::const_iterator i(page_action_views_.begin()); | 1026 for (PageActionViews::const_iterator i(page_action_views_.begin()); |
1026 i != page_action_views_.end(); ++i) { | 1027 i != page_action_views_.end(); ++i) { |
1027 (*i)->UpdateVisibility(model_->input_in_progress() ? NULL : contents, | 1028 (*i)->UpdateVisibility(model_->input_in_progress() ? NULL : contents, |
1028 url); | 1029 url); |
1029 | 1030 |
1030 // Check if the visibility of the action changed and notify if it did. | 1031 // Check if the visibility of the action changed and notify if it did. |
1031 ExtensionAction* action = (*i)->image_view()->page_action(); | 1032 ExtensionAction* action = (*i)->image_view()->page_action(); |
1032 if (old_visibility.find(action) == old_visibility.end() || | 1033 if (old_visibility.find(action) == old_visibility.end() || |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1281 return suggested_text_view_ && !suggested_text_view_->size().IsEmpty() && | 1282 return suggested_text_view_ && !suggested_text_view_->size().IsEmpty() && |
1282 !suggested_text_view_->text().empty(); | 1283 !suggested_text_view_->text().empty(); |
1283 } | 1284 } |
1284 | 1285 |
1285 #if !defined(USE_AURA) | 1286 #if !defined(USE_AURA) |
1286 OmniboxViewWin* LocationBarView::GetOmniboxViewWin() { | 1287 OmniboxViewWin* LocationBarView::GetOmniboxViewWin() { |
1287 return static_cast<OmniboxViewWin*>(location_entry_.get()); | 1288 return static_cast<OmniboxViewWin*>(location_entry_.get()); |
1288 } | 1289 } |
1289 #endif | 1290 #endif |
1290 #endif | 1291 #endif |
OLD | NEW |