| 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 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 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" |
| 33 #include "chrome/browser/ui/views/location_bar/keyword_hint_view.h" | 33 #include "chrome/browser/ui/views/location_bar/keyword_hint_view.h" |
| 34 #include "chrome/browser/ui/views/location_bar/location_icon_view.h" | 34 #include "chrome/browser/ui/views/location_bar/location_icon_view.h" |
| 35 #include "chrome/browser/ui/views/location_bar/page_action_image_view.h" | 35 #include "chrome/browser/ui/views/location_bar/page_action_image_view.h" |
| 36 #include "chrome/browser/ui/views/location_bar/page_action_with_badge_view.h" | 36 #include "chrome/browser/ui/views/location_bar/page_action_with_badge_view.h" |
| 37 #include "chrome/browser/ui/views/location_bar/selected_keyword_view.h" | 37 #include "chrome/browser/ui/views/location_bar/selected_keyword_view.h" |
| 38 #include "chrome/browser/ui/views/location_bar/star_view.h" | 38 #include "chrome/browser/ui/views/location_bar/star_view.h" |
| 39 #include "chrome/common/notification_service.h" |
| 39 #include "gfx/canvas_skia.h" | 40 #include "gfx/canvas_skia.h" |
| 40 #include "gfx/color_utils.h" | 41 #include "gfx/color_utils.h" |
| 41 #include "gfx/skia_util.h" | 42 #include "gfx/skia_util.h" |
| 42 #include "grit/generated_resources.h" | 43 #include "grit/generated_resources.h" |
| 43 #include "grit/theme_resources.h" | 44 #include "grit/theme_resources.h" |
| 44 #include "views/controls/label.h" | 45 #include "views/controls/label.h" |
| 45 #include "views/drag_utils.h" | 46 #include "views/drag_utils.h" |
| 46 | 47 |
| 47 #if defined(OS_WIN) | 48 #if defined(OS_WIN) |
| 48 #include "chrome/browser/ui/views/location_bar/suggested_text_view.h" | 49 #include "chrome/browser/ui/views/location_bar/suggested_text_view.h" |
| (...skipping 729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 778 void LocationBarView::OnAutocompleteWillAccept() { | 779 void LocationBarView::OnAutocompleteWillAccept() { |
| 779 update_instant_ = false; | 780 update_instant_ = false; |
| 780 } | 781 } |
| 781 | 782 |
| 782 bool LocationBarView::OnCommitSuggestedText(const std::wstring& typed_text) { | 783 bool LocationBarView::OnCommitSuggestedText(const std::wstring& typed_text) { |
| 783 InstantController* instant = delegate_->GetInstant(); | 784 InstantController* instant = delegate_->GetInstant(); |
| 784 if (!instant) | 785 if (!instant) |
| 785 return false; | 786 return false; |
| 786 | 787 |
| 787 #if defined(OS_WIN) | 788 #if defined(OS_WIN) |
| 788 if(!HasValidSuggestText()) | 789 if (!HasValidSuggestText()) |
| 789 return false; | 790 return false; |
| 790 location_entry_->model()->FinalizeInstantQuery( | 791 location_entry_->model()->FinalizeInstantQuery( |
| 791 typed_text, | 792 typed_text, |
| 792 suggested_text_view_->GetText()); | 793 suggested_text_view_->GetText()); |
| 793 return true; | 794 return true; |
| 794 #else | 795 #else |
| 795 return location_entry_->CommitInstantSuggestion(); | 796 return location_entry_->CommitInstantSuggestion(); |
| 796 #endif | 797 #endif |
| 797 } | 798 } |
| 798 | 799 |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 931 view->SetBounds( | 932 view->SetBounds( |
| 932 leading ? bounds->x() : (bounds->right() - view_size.width()), | 933 leading ? bounds->x() : (bounds->right() - view_size.width()), |
| 933 view->y(), view_size.width(), view->height()); | 934 view->y(), view_size.width(), view->height()); |
| 934 bounds->set_width(bounds->width() - desired_width); | 935 bounds->set_width(bounds->width() - desired_width); |
| 935 } | 936 } |
| 936 } | 937 } |
| 937 | 938 |
| 938 void LocationBarView::RefreshContentSettingViews() { | 939 void LocationBarView::RefreshContentSettingViews() { |
| 939 for (ContentSettingViews::const_iterator i(content_setting_views_.begin()); | 940 for (ContentSettingViews::const_iterator i(content_setting_views_.begin()); |
| 940 i != content_setting_views_.end(); ++i) { | 941 i != content_setting_views_.end(); ++i) { |
| 941 (*i)->UpdateFromTabContents( | 942 (*i)->UpdateFromTabContents(model_->input_in_progress() ? NULL : |
| 942 model_->input_in_progress() ? NULL : GetTabContentsFromDelegate(delegate
_)); | 943 GetTabContentsFromDelegate(delegate_)); |
| 943 } | 944 } |
| 944 } | 945 } |
| 945 | 946 |
| 946 void LocationBarView::DeletePageActionViews() { | 947 void LocationBarView::DeletePageActionViews() { |
| 947 for (PageActionViews::const_iterator i(page_action_views_.begin()); | 948 for (PageActionViews::const_iterator i(page_action_views_.begin()); |
| 948 i != page_action_views_.end(); ++i) | 949 i != page_action_views_.end(); ++i) |
| 949 RemoveChildView(*i); | 950 RemoveChildView(*i); |
| 950 STLDeleteElements(&page_action_views_); | 951 STLDeleteElements(&page_action_views_); |
| 951 } | 952 } |
| 952 | 953 |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1266 template_url_model_ = NULL; | 1267 template_url_model_ = NULL; |
| 1267 ShowFirstRunBubble(bubble_type_); | 1268 ShowFirstRunBubble(bubble_type_); |
| 1268 } | 1269 } |
| 1269 | 1270 |
| 1270 #if defined(OS_WIN) | 1271 #if defined(OS_WIN) |
| 1271 bool LocationBarView::HasValidSuggestText() { | 1272 bool LocationBarView::HasValidSuggestText() { |
| 1272 return suggested_text_view_ && !suggested_text_view_->size().IsEmpty() && | 1273 return suggested_text_view_ && !suggested_text_view_->size().IsEmpty() && |
| 1273 !suggested_text_view_->GetText().empty(); | 1274 !suggested_text_view_->GetText().empty(); |
| 1274 } | 1275 } |
| 1275 #endif | 1276 #endif |
| OLD | NEW |