| 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 "chrome/app/chrome_dll_resource.h" | 15 #include "chrome/app/chrome_dll_resource.h" |
| 16 #include "chrome/browser/alternate_nav_url_fetcher.h" | 16 #include "chrome/browser/alternate_nav_url_fetcher.h" |
| 17 #include "chrome/browser/extensions/extension_browser_event_router.h" | 17 #include "chrome/browser/extensions/extension_browser_event_router.h" |
| 18 #include "chrome/browser/extensions/extensions_service.h" | 18 #include "chrome/browser/extensions/extensions_service.h" |
| 19 #include "chrome/browser/profile.h" | 19 #include "chrome/browser/profile.h" |
| 20 #include "chrome/browser/search_engines/template_url_model.h" |
| 20 #include "chrome/browser/view_ids.h" | 21 #include "chrome/browser/view_ids.h" |
| 21 #include "chrome/browser/views/browser_dialogs.h" | 22 #include "chrome/browser/views/browser_dialogs.h" |
| 22 #include "chrome/browser/views/location_bar/content_setting_image_view.h" | 23 #include "chrome/browser/views/location_bar/content_setting_image_view.h" |
| 23 #include "chrome/browser/views/location_bar/ev_bubble_view.h" | 24 #include "chrome/browser/views/location_bar/ev_bubble_view.h" |
| 24 #include "chrome/browser/views/location_bar/keyword_hint_view.h" | 25 #include "chrome/browser/views/location_bar/keyword_hint_view.h" |
| 25 #include "chrome/browser/views/location_bar/location_icon_view.h" | 26 #include "chrome/browser/views/location_bar/location_icon_view.h" |
| 26 #include "chrome/browser/views/location_bar/page_action_image_view.h" | 27 #include "chrome/browser/views/location_bar/page_action_image_view.h" |
| 27 #include "chrome/browser/views/location_bar/page_action_with_badge_view.h" | 28 #include "chrome/browser/views/location_bar/page_action_with_badge_view.h" |
| 28 #include "chrome/browser/views/location_bar/selected_keyword_view.h" | 29 #include "chrome/browser/views/location_bar/selected_keyword_view.h" |
| 29 #include "chrome/browser/views/location_bar/star_view.h" | 30 #include "chrome/browser/views/location_bar/star_view.h" |
| (...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 450 #endif | 451 #endif |
| 451 | 452 |
| 452 if (max_edit_width < 0) | 453 if (max_edit_width < 0) |
| 453 return; | 454 return; |
| 454 const int available_width = AvailableWidth(max_edit_width); | 455 const int available_width = AvailableWidth(max_edit_width); |
| 455 | 456 |
| 456 const bool show_keyword_hint = !keyword.empty() && is_keyword_hint; | 457 const bool show_keyword_hint = !keyword.empty() && is_keyword_hint; |
| 457 selected_keyword_view_->SetVisible(show_selected_keyword); | 458 selected_keyword_view_->SetVisible(show_selected_keyword); |
| 458 keyword_hint_view_->SetVisible(show_keyword_hint); | 459 keyword_hint_view_->SetVisible(show_keyword_hint); |
| 459 if (show_selected_keyword) { | 460 if (show_selected_keyword) { |
| 460 if (selected_keyword_view_->keyword() != keyword) | 461 if (selected_keyword_view_->keyword() != keyword) { |
| 461 selected_keyword_view_->SetKeyword(keyword); | 462 selected_keyword_view_->SetKeyword(keyword); |
| 463 |
| 464 const TemplateURL* template_url = |
| 465 profile_->GetTemplateURLModel()->GetTemplateURLForKeyword(keyword); |
| 466 if (template_url && template_url->IsExtensionKeyword()) { |
| 467 const SkBitmap& bitmap = profile_->GetExtensionsService()-> |
| 468 GetOmniboxIcon(template_url->GetExtensionId()); |
| 469 selected_keyword_view_->SetImage(bitmap); |
| 470 } else { |
| 471 selected_keyword_view_->SetImage(*ResourceBundle::GetSharedInstance(). |
| 472 GetBitmapNamed(IDR_OMNIBOX_SEARCH)); |
| 473 } |
| 474 } |
| 462 } else if (show_keyword_hint) { | 475 } else if (show_keyword_hint) { |
| 463 if (keyword_hint_view_->keyword() != keyword) | 476 if (keyword_hint_view_->keyword() != keyword) |
| 464 keyword_hint_view_->SetKeyword(keyword); | 477 keyword_hint_view_->SetKeyword(keyword); |
| 465 } | 478 } |
| 466 | 479 |
| 467 // TODO(sky): baseline layout. | 480 // TODO(sky): baseline layout. |
| 468 int location_y = TopMargin(); | 481 int location_y = TopMargin(); |
| 469 int location_height = std::max(height() - location_y - kVertMargin, 0); | 482 int location_height = std::max(height() - location_y - kVertMargin, 0); |
| 470 | 483 |
| 471 // Lay out items to the right of the edit field. | 484 // Lay out items to the right of the edit field. |
| (...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1038 page_action_views_[i]->image_view()->ExecuteAction(kLeftMouseButton, | 1051 page_action_views_[i]->image_view()->ExecuteAction(kLeftMouseButton, |
| 1039 false); // inspect_with_devtools | 1052 false); // inspect_with_devtools |
| 1040 return; | 1053 return; |
| 1041 } | 1054 } |
| 1042 ++current; | 1055 ++current; |
| 1043 } | 1056 } |
| 1044 } | 1057 } |
| 1045 | 1058 |
| 1046 NOTREACHED(); | 1059 NOTREACHED(); |
| 1047 } | 1060 } |
| OLD | NEW |