OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/views/location_bar/location_bar_view.h" | 5 #include "chrome/browser/views/location_bar/location_bar_view.h" |
6 | 6 |
7 #if defined(OS_LINUX) | 7 #if defined(OS_LINUX) |
8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
9 #endif | 9 #endif |
10 | 10 |
11 #include "app/drag_drop_types.h" | 11 #include "app/drag_drop_types.h" |
12 #include "app/l10n_util.h" | 12 #include "app/l10n_util.h" |
13 #include "app/resource_bundle.h" | 13 #include "app/resource_bundle.h" |
14 #include "app/theme_provider.h" | 14 #include "app/theme_provider.h" |
15 #include "base/stl_util-inl.h" | 15 #include "base/stl_util-inl.h" |
16 #include "base/utf_string_conversions.h" | 16 #include "base/utf_string_conversions.h" |
17 #include "chrome/app/chrome_command_ids.h" | 17 #include "chrome/app/chrome_command_ids.h" |
18 #include "chrome/browser/alternate_nav_url_fetcher.h" | 18 #include "chrome/browser/alternate_nav_url_fetcher.h" |
19 #include "chrome/browser/autocomplete/autocomplete_popup_model.h" | 19 #include "chrome/browser/autocomplete/autocomplete_popup_model.h" |
20 #include "chrome/browser/defaults.h" | 20 #include "chrome/browser/defaults.h" |
21 #include "chrome/browser/extensions/extension_browser_event_router.h" | 21 #include "chrome/browser/extensions/extension_browser_event_router.h" |
22 #include "chrome/browser/extensions/extensions_service.h" | 22 #include "chrome/browser/extensions/extension_service.h" |
23 #include "chrome/browser/instant/instant_controller.h" | 23 #include "chrome/browser/instant/instant_controller.h" |
24 #include "chrome/browser/profiles/profile.h" | 24 #include "chrome/browser/profiles/profile.h" |
25 #include "chrome/browser/renderer_host/render_widget_host_view.h" | 25 #include "chrome/browser/renderer_host/render_widget_host_view.h" |
26 #include "chrome/browser/search_engines/template_url.h" | 26 #include "chrome/browser/search_engines/template_url.h" |
27 #include "chrome/browser/search_engines/template_url_model.h" | 27 #include "chrome/browser/search_engines/template_url_model.h" |
28 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 28 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
29 #include "chrome/browser/ui/view_ids.h" | 29 #include "chrome/browser/ui/view_ids.h" |
30 #include "chrome/browser/ui/views/browser_dialogs.h" | 30 #include "chrome/browser/ui/views/browser_dialogs.h" |
31 #include "chrome/browser/ui/views/location_bar/content_setting_image_view.h" | 31 #include "chrome/browser/ui/views/location_bar/content_setting_image_view.h" |
32 #include "chrome/browser/ui/views/location_bar/ev_bubble_view.h" | 32 #include "chrome/browser/ui/views/location_bar/ev_bubble_view.h" |
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
522 | 522 |
523 const bool show_keyword_hint = !keyword.empty() && is_keyword_hint; | 523 const bool show_keyword_hint = !keyword.empty() && is_keyword_hint; |
524 selected_keyword_view_->SetVisible(show_selected_keyword); | 524 selected_keyword_view_->SetVisible(show_selected_keyword); |
525 keyword_hint_view_->SetVisible(show_keyword_hint); | 525 keyword_hint_view_->SetVisible(show_keyword_hint); |
526 if (show_selected_keyword) { | 526 if (show_selected_keyword) { |
527 if (selected_keyword_view_->keyword() != keyword) { | 527 if (selected_keyword_view_->keyword() != keyword) { |
528 selected_keyword_view_->SetKeyword(keyword); | 528 selected_keyword_view_->SetKeyword(keyword); |
529 const TemplateURL* template_url = | 529 const TemplateURL* template_url = |
530 profile_->GetTemplateURLModel()->GetTemplateURLForKeyword(keyword); | 530 profile_->GetTemplateURLModel()->GetTemplateURLForKeyword(keyword); |
531 if (template_url && template_url->IsExtensionKeyword()) { | 531 if (template_url && template_url->IsExtensionKeyword()) { |
532 const SkBitmap& bitmap = profile_->GetExtensionsService()-> | 532 const SkBitmap& bitmap = profile_->GetExtensionService()-> |
533 GetOmniboxIcon(template_url->GetExtensionId()); | 533 GetOmniboxIcon(template_url->GetExtensionId()); |
534 selected_keyword_view_->SetImage(bitmap); | 534 selected_keyword_view_->SetImage(bitmap); |
535 selected_keyword_view_->SetItemPadding(kExtensionItemPadding); | 535 selected_keyword_view_->SetItemPadding(kExtensionItemPadding); |
536 } else { | 536 } else { |
537 selected_keyword_view_->SetImage(*ResourceBundle::GetSharedInstance(). | 537 selected_keyword_view_->SetImage(*ResourceBundle::GetSharedInstance(). |
538 GetBitmapNamed(IDR_OMNIBOX_SEARCH)); | 538 GetBitmapNamed(IDR_OMNIBOX_SEARCH)); |
539 selected_keyword_view_->SetItemPadding(kItemPadding); | 539 selected_keyword_view_->SetItemPadding(kItemPadding); |
540 } | 540 } |
541 } | 541 } |
542 } else if (show_keyword_hint) { | 542 } else if (show_keyword_hint) { |
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
947 for (PageActionViews::const_iterator i(page_action_views_.begin()); | 947 for (PageActionViews::const_iterator i(page_action_views_.begin()); |
948 i != page_action_views_.end(); ++i) | 948 i != page_action_views_.end(); ++i) |
949 RemoveChildView(*i); | 949 RemoveChildView(*i); |
950 STLDeleteElements(&page_action_views_); | 950 STLDeleteElements(&page_action_views_); |
951 } | 951 } |
952 | 952 |
953 void LocationBarView::RefreshPageActionViews() { | 953 void LocationBarView::RefreshPageActionViews() { |
954 if (mode_ != NORMAL) | 954 if (mode_ != NORMAL) |
955 return; | 955 return; |
956 | 956 |
957 ExtensionsService* service = profile_->GetExtensionsService(); | 957 ExtensionService* service = profile_->GetExtensionService(); |
958 if (!service) | 958 if (!service) |
959 return; | 959 return; |
960 | 960 |
961 std::map<ExtensionAction*, bool> old_visibility; | 961 std::map<ExtensionAction*, bool> old_visibility; |
962 for (PageActionViews::const_iterator i(page_action_views_.begin()); | 962 for (PageActionViews::const_iterator i(page_action_views_.begin()); |
963 i != page_action_views_.end(); ++i) | 963 i != page_action_views_.end(); ++i) |
964 old_visibility[(*i)->image_view()->page_action()] = (*i)->IsVisible(); | 964 old_visibility[(*i)->image_view()->page_action()] = (*i)->IsVisible(); |
965 | 965 |
966 // Remember the previous visibility of the page actions so that we can | 966 // Remember the previous visibility of the page actions so that we can |
967 // notify when this changes. | 967 // notify when this changes. |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1266 template_url_model_ = NULL; | 1266 template_url_model_ = NULL; |
1267 ShowFirstRunBubble(bubble_type_); | 1267 ShowFirstRunBubble(bubble_type_); |
1268 } | 1268 } |
1269 | 1269 |
1270 #if defined(OS_WIN) | 1270 #if defined(OS_WIN) |
1271 bool LocationBarView::HasValidSuggestText() { | 1271 bool LocationBarView::HasValidSuggestText() { |
1272 return suggested_text_view_ && !suggested_text_view_->size().IsEmpty() && | 1272 return suggested_text_view_ && !suggested_text_view_->size().IsEmpty() && |
1273 !suggested_text_view_->GetText().empty(); | 1273 !suggested_text_view_->GetText().empty(); |
1274 } | 1274 } |
1275 #endif | 1275 #endif |
OLD | NEW |