OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/gtk/location_bar_view_gtk.h" | 5 #include "chrome/browser/gtk/location_bar_view_gtk.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "app/gfx/canvas_paint.h" | 9 #include "app/gfx/canvas_paint.h" |
10 #include "app/gfx/gtk_util.h" | 10 #include "app/gfx/gtk_util.h" |
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 location_entry_->SetFocus(); | 398 location_entry_->SetFocus(); |
399 location_entry_->SelectAll(true); | 399 location_entry_->SelectAll(true); |
400 } | 400 } |
401 | 401 |
402 void LocationBarViewGtk::FocusSearch() { | 402 void LocationBarViewGtk::FocusSearch() { |
403 location_entry_->SetFocus(); | 403 location_entry_->SetFocus(); |
404 location_entry_->SetForcedQuery(); | 404 location_entry_->SetForcedQuery(); |
405 } | 405 } |
406 | 406 |
407 void LocationBarViewGtk::UpdatePageActions() { | 407 void LocationBarViewGtk::UpdatePageActions() { |
408 std::vector<ExtensionAction2*> page_actions; | 408 std::vector<ExtensionAction*> page_actions; |
409 ExtensionsService* service = profile_->GetExtensionsService(); | 409 ExtensionsService* service = profile_->GetExtensionsService(); |
410 if (!service) | 410 if (!service) |
411 return; | 411 return; |
412 | 412 |
413 // Find all the page actions. | 413 // Find all the page actions. |
414 for (size_t i = 0; i < service->extensions()->size(); ++i) { | 414 for (size_t i = 0; i < service->extensions()->size(); ++i) { |
415 if (service->extensions()->at(i)->page_action()) | 415 if (service->extensions()->at(i)->page_action()) |
416 page_actions.push_back(service->extensions()->at(i)->page_action()); | 416 page_actions.push_back(service->extensions()->at(i)->page_action()); |
417 } | 417 } |
418 | 418 |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
680 } | 680 } |
681 tab->ShowPageInfo(nav_entry->url(), nav_entry->ssl(), true); | 681 tab->ShowPageInfo(nav_entry->url(), nav_entry->ssl(), true); |
682 return true; | 682 return true; |
683 } | 683 } |
684 | 684 |
685 //////////////////////////////////////////////////////////////////////////////// | 685 //////////////////////////////////////////////////////////////////////////////// |
686 // LocationBarViewGtk::PageActionViewGtk | 686 // LocationBarViewGtk::PageActionViewGtk |
687 | 687 |
688 LocationBarViewGtk::PageActionViewGtk::PageActionViewGtk( | 688 LocationBarViewGtk::PageActionViewGtk::PageActionViewGtk( |
689 LocationBarViewGtk* owner, Profile* profile, | 689 LocationBarViewGtk* owner, Profile* profile, |
690 ExtensionAction2* page_action) | 690 ExtensionAction* page_action) |
691 : owner_(owner), | 691 : owner_(owner), |
692 profile_(profile), | 692 profile_(profile), |
693 page_action_(page_action), | 693 page_action_(page_action), |
694 last_icon_pixbuf_(NULL) { | 694 last_icon_pixbuf_(NULL) { |
695 event_box_.Own(gtk_event_box_new()); | 695 event_box_.Own(gtk_event_box_new()); |
696 gtk_widget_set_size_request(event_box_.get(), kButtonSize, kButtonSize); | 696 gtk_widget_set_size_request(event_box_.get(), kButtonSize, kButtonSize); |
697 | 697 |
698 // Make the event box not visible so it does not paint a background. | 698 // Make the event box not visible so it does not paint a background. |
699 gtk_event_box_set_visible_window(GTK_EVENT_BOX(event_box_.get()), FALSE); | 699 gtk_event_box_set_visible_window(GTK_EVENT_BOX(event_box_.get()), FALSE); |
700 g_signal_connect(event_box_.get(), "button-press-event", | 700 g_signal_connect(event_box_.get(), "button-press-event", |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
857 | 857 |
858 std::string badge_text = view->page_action_->GetBadgeText(tab_id); | 858 std::string badge_text = view->page_action_->GetBadgeText(tab_id); |
859 if (badge_text.empty()) | 859 if (badge_text.empty()) |
860 return FALSE; | 860 return FALSE; |
861 | 861 |
862 gfx::CanvasPaint canvas(event, false); | 862 gfx::CanvasPaint canvas(event, false); |
863 gfx::Rect bounding_rect(widget->allocation); | 863 gfx::Rect bounding_rect(widget->allocation); |
864 view->page_action_->PaintBadge(&canvas, bounding_rect, tab_id); | 864 view->page_action_->PaintBadge(&canvas, bounding_rect, tab_id); |
865 return FALSE; | 865 return FALSE; |
866 } | 866 } |
OLD | NEW |