Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(12)

Side by Side Diff: chrome/browser/ui/views/location_bar/location_bar_view.cc

Issue 11446034: SupportsUserData and manifest handlers for Extension; use them for the Omnibox API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase + manifestdata Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/command_updater.h" 15 #include "chrome/browser/command_updater.h"
16 #include "chrome/browser/defaults.h" 16 #include "chrome/browser/defaults.h"
17 #include "chrome/browser/extensions/extension_service.h" 17 #include "chrome/browser/extensions/api/omnibox/omnibox_api.h"
18 #include "chrome/browser/extensions/extension_system.h"
19 #include "chrome/browser/extensions/location_bar_controller.h" 18 #include "chrome/browser/extensions/location_bar_controller.h"
20 #include "chrome/browser/extensions/script_bubble_controller.h" 19 #include "chrome/browser/extensions/script_bubble_controller.h"
21 #include "chrome/browser/extensions/tab_helper.h" 20 #include "chrome/browser/extensions/tab_helper.h"
22 #include "chrome/browser/favicon/favicon_tab_helper.h" 21 #include "chrome/browser/favicon/favicon_tab_helper.h"
23 #include "chrome/browser/prefs/pref_service.h" 22 #include "chrome/browser/prefs/pref_service.h"
24 #include "chrome/browser/profiles/profile.h" 23 #include "chrome/browser/profiles/profile.h"
25 #include "chrome/browser/search_engines/template_url.h" 24 #include "chrome/browser/search_engines/template_url.h"
26 #include "chrome/browser/search_engines/template_url_service.h" 25 #include "chrome/browser/search_engines/template_url_service.h"
27 #include "chrome/browser/search_engines/template_url_service_factory.h" 26 #include "chrome/browser/search_engines/template_url_service_factory.h"
28 #include "chrome/browser/ui/browser.h" 27 #include "chrome/browser/ui/browser.h"
(...skipping 720 matching lines...) Expand 10 before | Expand all | Expand 10 after
749 const bool show_keyword_hint = !keyword.empty() && is_keyword_hint; 748 const bool show_keyword_hint = !keyword.empty() && is_keyword_hint;
750 selected_keyword_view_->SetVisible(show_selected_keyword); 749 selected_keyword_view_->SetVisible(show_selected_keyword);
751 keyword_hint_view_->SetVisible(show_keyword_hint); 750 keyword_hint_view_->SetVisible(show_keyword_hint);
752 if (show_selected_keyword) { 751 if (show_selected_keyword) {
753 if (selected_keyword_view_->keyword() != keyword) { 752 if (selected_keyword_view_->keyword() != keyword) {
754 selected_keyword_view_->SetKeyword(keyword); 753 selected_keyword_view_->SetKeyword(keyword);
755 const TemplateURL* template_url = 754 const TemplateURL* template_url =
756 TemplateURLServiceFactory::GetForProfile(profile_)-> 755 TemplateURLServiceFactory::GetForProfile(profile_)->
757 GetTemplateURLForKeyword(keyword); 756 GetTemplateURLForKeyword(keyword);
758 if (template_url && template_url->IsExtensionKeyword()) { 757 if (template_url && template_url->IsExtensionKeyword()) {
759 gfx::Image image = extensions::ExtensionSystem::Get(profile_)-> 758 gfx::Image image = extensions::OmniboxAPI::Get(profile_)->
760 extension_service()->GetOmniboxIcon(template_url->GetExtensionId()); 759 GetOmniboxIcon(template_url->GetExtensionId());
761 selected_keyword_view_->SetImage(image.AsImageSkia()); 760 selected_keyword_view_->SetImage(image.AsImageSkia());
762 selected_keyword_view_->set_is_extension_icon(true); 761 selected_keyword_view_->set_is_extension_icon(true);
763 } else { 762 } else {
764 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); 763 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
765 selected_keyword_view_->SetImage( 764 selected_keyword_view_->SetImage(
766 *rb.GetImageSkiaNamed(IDR_OMNIBOX_SEARCH)); 765 *rb.GetImageSkiaNamed(IDR_OMNIBOX_SEARCH));
767 selected_keyword_view_->set_is_extension_icon(false); 766 selected_keyword_view_->set_is_extension_icon(false);
768 } 767 }
769 } 768 }
770 } else if (show_keyword_hint) { 769 } else if (show_keyword_hint) {
(...skipping 791 matching lines...) Expand 10 before | Expand all | Expand 10 after
1562 int LocationBarView::GetInternalHeight(bool use_preferred_size) { 1561 int LocationBarView::GetInternalHeight(bool use_preferred_size) {
1563 int total_height = 1562 int total_height =
1564 use_preferred_size ? GetPreferredSize().height() : height(); 1563 use_preferred_size ? GetPreferredSize().height() : height();
1565 return std::max(total_height - (kVerticalEdgeThickness * 2), 0); 1564 return std::max(total_height - (kVerticalEdgeThickness * 2), 0);
1566 } 1565 }
1567 1566
1568 bool LocationBarView::HasValidSuggestText() const { 1567 bool LocationBarView::HasValidSuggestText() const {
1569 return suggested_text_view_ && !suggested_text_view_->size().IsEmpty() && 1568 return suggested_text_view_ && !suggested_text_view_->size().IsEmpty() &&
1570 !suggested_text_view_->text().empty(); 1569 !suggested_text_view_->text().empty();
1571 } 1570 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698