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

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: 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_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 729 matching lines...) Expand 10 before | Expand all | Expand 10 after
758 const bool show_keyword_hint = !keyword.empty() && is_keyword_hint; 757 const bool show_keyword_hint = !keyword.empty() && is_keyword_hint;
759 selected_keyword_view_->SetVisible(show_selected_keyword); 758 selected_keyword_view_->SetVisible(show_selected_keyword);
760 keyword_hint_view_->SetVisible(show_keyword_hint); 759 keyword_hint_view_->SetVisible(show_keyword_hint);
761 if (show_selected_keyword) { 760 if (show_selected_keyword) {
762 if (selected_keyword_view_->keyword() != keyword) { 761 if (selected_keyword_view_->keyword() != keyword) {
763 selected_keyword_view_->SetKeyword(keyword); 762 selected_keyword_view_->SetKeyword(keyword);
764 const TemplateURL* template_url = 763 const TemplateURL* template_url =
765 TemplateURLServiceFactory::GetForProfile(profile_)-> 764 TemplateURLServiceFactory::GetForProfile(profile_)->
766 GetTemplateURLForKeyword(keyword); 765 GetTemplateURLForKeyword(keyword);
767 if (template_url && template_url->IsExtensionKeyword()) { 766 if (template_url && template_url->IsExtensionKeyword()) {
768 gfx::Image image = extensions::ExtensionSystem::Get(profile_)-> 767 gfx::Image image = extensions::OmniboxAPI::Get(profile_)->
769 extension_service()->GetOmniboxIcon(template_url->GetExtensionId()); 768 GetOmniboxIcon(template_url->GetExtensionId());
770 selected_keyword_view_->SetImage(image.AsImageSkia()); 769 selected_keyword_view_->SetImage(image.AsImageSkia());
771 selected_keyword_view_->set_is_extension_icon(true); 770 selected_keyword_view_->set_is_extension_icon(true);
772 } else { 771 } else {
773 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); 772 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
774 selected_keyword_view_->SetImage( 773 selected_keyword_view_->SetImage(
775 *rb.GetImageSkiaNamed(IDR_OMNIBOX_SEARCH)); 774 *rb.GetImageSkiaNamed(IDR_OMNIBOX_SEARCH));
776 selected_keyword_view_->set_is_extension_icon(false); 775 selected_keyword_view_->set_is_extension_icon(false);
777 } 776 }
778 } 777 }
779 } else if (show_keyword_hint) { 778 } else if (show_keyword_hint) {
(...skipping 791 matching lines...) Expand 10 before | Expand all | Expand 10 after
1571 int LocationBarView::GetInternalHeight(bool use_preferred_size) { 1570 int LocationBarView::GetInternalHeight(bool use_preferred_size) {
1572 int total_height = 1571 int total_height =
1573 use_preferred_size ? GetPreferredSize().height() : height(); 1572 use_preferred_size ? GetPreferredSize().height() : height();
1574 return std::max(total_height - (kVerticalEdgeThickness * 2), 0); 1573 return std::max(total_height - (kVerticalEdgeThickness * 2), 0);
1575 } 1574 }
1576 1575
1577 bool LocationBarView::HasValidSuggestText() const { 1576 bool LocationBarView::HasValidSuggestText() const {
1578 return suggested_text_view_ && !suggested_text_view_->size().IsEmpty() && 1577 return suggested_text_view_ && !suggested_text_view_->size().IsEmpty() &&
1579 !suggested_text_view_->text().empty(); 1578 !suggested_text_view_->text().empty();
1580 } 1579 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698