OLD | NEW |
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/gtk/location_bar_view_gtk.h" | 5 #include "chrome/browser/ui/gtk/location_bar_view_gtk.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
537 // The navigation controller will delete the fetcher. | 537 // The navigation controller will delete the fetcher. |
538 } | 538 } |
539 } | 539 } |
540 } | 540 } |
541 } | 541 } |
542 } | 542 } |
543 | 543 |
544 void LocationBarViewGtk::OnChanged() { | 544 void LocationBarViewGtk::OnChanged() { |
545 UpdateSiteTypeArea(); | 545 UpdateSiteTypeArea(); |
546 | 546 |
547 const string16 keyword(location_entry_->model()->keyword()); | 547 const string16 keyword(location_entry_->GetModel()->keyword()); |
548 const bool is_keyword_hint = location_entry_->model()->is_keyword_hint(); | 548 const bool is_keyword_hint = location_entry_->GetModel()->is_keyword_hint(); |
549 show_selected_keyword_ = !keyword.empty() && !is_keyword_hint; | 549 show_selected_keyword_ = !keyword.empty() && !is_keyword_hint; |
550 show_keyword_hint_ = !keyword.empty() && is_keyword_hint; | 550 show_keyword_hint_ = !keyword.empty() && is_keyword_hint; |
551 | 551 |
552 if (show_selected_keyword_) | 552 if (show_selected_keyword_) |
553 SetKeywordLabel(keyword); | 553 SetKeywordLabel(keyword); |
554 | 554 |
555 if (show_keyword_hint_) | 555 if (show_keyword_hint_) |
556 SetKeywordHintLabel(keyword); | 556 SetKeywordHintLabel(keyword); |
557 | 557 |
558 AdjustChildrenVisibility(); | 558 AdjustChildrenVisibility(); |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
672 // We need the browser window to be shown before we can show the bubble, but | 672 // We need the browser window to be shown before we can show the bubble, but |
673 // we get called before that's happened. | 673 // we get called before that's happened. |
674 MessageLoop::current()->PostTask( | 674 MessageLoop::current()->PostTask( |
675 FROM_HERE, | 675 FROM_HERE, |
676 base::Bind(&LocationBarViewGtk::ShowFirstRunBubbleInternal, | 676 base::Bind(&LocationBarViewGtk::ShowFirstRunBubbleInternal, |
677 weak_ptr_factory_.GetWeakPtr())); | 677 weak_ptr_factory_.GetWeakPtr())); |
678 } | 678 } |
679 | 679 |
680 void LocationBarViewGtk::SetSuggestedText(const string16& text, | 680 void LocationBarViewGtk::SetSuggestedText(const string16& text, |
681 InstantCompleteBehavior behavior) { | 681 InstantCompleteBehavior behavior) { |
682 location_entry_->model()->SetSuggestedText(text, behavior); | 682 location_entry_->GetModel()->SetSuggestedText(text, behavior); |
683 } | 683 } |
684 | 684 |
685 string16 LocationBarViewGtk::GetInputString() const { | 685 string16 LocationBarViewGtk::GetInputString() const { |
686 return location_input_; | 686 return location_input_; |
687 } | 687 } |
688 | 688 |
689 WindowOpenDisposition LocationBarViewGtk::GetWindowOpenDisposition() const { | 689 WindowOpenDisposition LocationBarViewGtk::GetWindowOpenDisposition() const { |
690 return disposition_; | 690 return disposition_; |
691 } | 691 } |
692 | 692 |
693 content::PageTransition LocationBarViewGtk::GetPageTransition() const { | 693 content::PageTransition LocationBarViewGtk::GetPageTransition() const { |
694 return transition_; | 694 return transition_; |
695 } | 695 } |
696 | 696 |
697 void LocationBarViewGtk::AcceptInput() { | 697 void LocationBarViewGtk::AcceptInput() { |
698 location_entry_->model()->AcceptInput(CURRENT_TAB, false); | 698 location_entry_->GetModel()->AcceptInput(CURRENT_TAB, false); |
699 } | 699 } |
700 | 700 |
701 void LocationBarViewGtk::FocusLocation(bool select_all) { | 701 void LocationBarViewGtk::FocusLocation(bool select_all) { |
702 location_entry_->SetFocus(); | 702 location_entry_->SetFocus(); |
703 if (select_all) | 703 if (select_all) |
704 location_entry_->SelectAll(true); | 704 location_entry_->SelectAll(true); |
705 } | 705 } |
706 | 706 |
707 void LocationBarViewGtk::FocusSearch() { | 707 void LocationBarViewGtk::FocusSearch() { |
708 location_entry_->SetFocus(); | 708 location_entry_->SetFocus(); |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
949 0, 0, 0, 0, 0, 0); | 949 0, 0, 0, 0, 0, 0); |
950 background.RenderToWidget(widget); | 950 background.RenderToWidget(widget); |
951 } | 951 } |
952 | 952 |
953 return FALSE; // Continue propagating the expose. | 953 return FALSE; // Continue propagating the expose. |
954 } | 954 } |
955 | 955 |
956 void LocationBarViewGtk::UpdateSiteTypeArea() { | 956 void LocationBarViewGtk::UpdateSiteTypeArea() { |
957 // The icon is always visible except when the |tab_to_search_alignment_| is | 957 // The icon is always visible except when the |tab_to_search_alignment_| is |
958 // visible. | 958 // visible. |
959 if (!location_entry_->model()->keyword().empty() && | 959 if (!location_entry_->GetModel()->keyword().empty() && |
960 !location_entry_->model()->is_keyword_hint()) { | 960 !location_entry_->GetModel()->is_keyword_hint()) { |
961 gtk_widget_hide(site_type_area()); | 961 gtk_widget_hide(site_type_area()); |
962 return; | 962 return; |
963 } | 963 } |
964 | 964 |
965 int resource_id = location_entry_->GetIcon(); | 965 int resource_id = location_entry_->GetIcon(); |
966 gtk_image_set_from_pixbuf( | 966 gtk_image_set_from_pixbuf( |
967 GTK_IMAGE(location_icon_image_), | 967 GTK_IMAGE(location_icon_image_), |
968 theme_service_->GetImageNamed(resource_id)->ToGdkPixbuf()); | 968 theme_service_->GetImageNamed(resource_id)->ToGdkPixbuf()); |
969 | 969 |
970 if (toolbar_model_->GetSecurityLevel() == ToolbarModel::EV_SECURE) { | 970 if (toolbar_model_->GetSecurityLevel() == ToolbarModel::EV_SECURE) { |
(...skipping 1002 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1973 } | 1973 } |
1974 | 1974 |
1975 void LocationBarViewGtk::PageActionViewGtk::InspectPopup( | 1975 void LocationBarViewGtk::PageActionViewGtk::InspectPopup( |
1976 ExtensionAction* action) { | 1976 ExtensionAction* action) { |
1977 ExtensionPopupGtk::Show( | 1977 ExtensionPopupGtk::Show( |
1978 action->GetPopupUrl(current_tab_id_), | 1978 action->GetPopupUrl(current_tab_id_), |
1979 owner_->browser_, | 1979 owner_->browser_, |
1980 event_box_.get(), | 1980 event_box_.get(), |
1981 ExtensionPopupGtk::SHOW_AND_INSPECT); | 1981 ExtensionPopupGtk::SHOW_AND_INSPECT); |
1982 } | 1982 } |
OLD | NEW |