| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
| 13 #include "base/i18n/rtl.h" | 13 #include "base/i18n/rtl.h" |
| 14 #include "base/logging.h" | 14 #include "base/logging.h" |
| 15 #include "base/string_util.h" | 15 #include "base/string_util.h" |
| 16 #include "base/utf_string_conversions.h" | 16 #include "base/utf_string_conversions.h" |
| 17 #include "chrome/app/chrome_command_ids.h" | 17 #include "chrome/app/chrome_command_ids.h" |
| 18 #include "chrome/browser/accessibility_events.h" | 18 #include "chrome/browser/accessibility_events.h" |
| 19 #include "chrome/browser/alternate_nav_url_fetcher.h" | 19 #include "chrome/browser/alternate_nav_url_fetcher.h" |
| 20 #include "chrome/browser/autocomplete/autocomplete_edit_view_gtk.h" | 20 #include "chrome/browser/autocomplete/autocomplete_edit_view_gtk.h" |
| 21 #include "chrome/browser/autocomplete/autocomplete_popup_model.h" | 21 #include "chrome/browser/autocomplete/autocomplete_popup_model.h" |
| 22 #include "chrome/browser/browser_list.h" | 22 #include "chrome/browser/browser_list.h" |
| 23 #include "chrome/browser/command_updater.h" | 23 #include "chrome/browser/command_updater.h" |
| 24 #include "chrome/browser/content_setting_bubble_model.h" | 24 #include "chrome/browser/content_setting_bubble_model.h" |
| 25 #include "chrome/browser/content_setting_image_model.h" | 25 #include "chrome/browser/content_setting_image_model.h" |
| 26 #include "chrome/browser/defaults.h" | 26 #include "chrome/browser/defaults.h" |
| 27 #include "chrome/browser/extensions/extension_browser_event_router.h" | 27 #include "chrome/browser/extensions/extension_browser_event_router.h" |
| 28 #include "chrome/browser/extensions/extension_service.h" | 28 #include "chrome/browser/extensions/extension_service.h" |
| 29 #include "chrome/browser/extensions/extension_tabs_module.h" | 29 #include "chrome/browser/extensions/extension_tabs_module.h" |
| 30 #include "chrome/browser/favicon_tab_helper.h" |
| 30 #include "chrome/browser/instant/instant_controller.h" | 31 #include "chrome/browser/instant/instant_controller.h" |
| 31 #include "chrome/browser/profiles/profile.h" | 32 #include "chrome/browser/profiles/profile.h" |
| 32 #include "chrome/browser/search_engines/template_url.h" | 33 #include "chrome/browser/search_engines/template_url.h" |
| 33 #include "chrome/browser/search_engines/template_url_model.h" | 34 #include "chrome/browser/search_engines/template_url_model.h" |
| 34 #include "chrome/browser/ui/browser.h" | 35 #include "chrome/browser/ui/browser.h" |
| 35 #include "chrome/browser/ui/gtk/bookmarks/bookmark_bubble_gtk.h" | 36 #include "chrome/browser/ui/gtk/bookmarks/bookmark_bubble_gtk.h" |
| 36 #include "chrome/browser/ui/gtk/bookmarks/bookmark_utils_gtk.h" | 37 #include "chrome/browser/ui/gtk/bookmarks/bookmark_utils_gtk.h" |
| 37 #include "chrome/browser/ui/gtk/cairo_cached_surface.h" | 38 #include "chrome/browser/ui/gtk/cairo_cached_surface.h" |
| 38 #include "chrome/browser/ui/gtk/content_setting_bubble_gtk.h" | 39 #include "chrome/browser/ui/gtk/content_setting_bubble_gtk.h" |
| 39 #include "chrome/browser/ui/gtk/extensions/extension_popup_gtk.h" | 40 #include "chrome/browser/ui/gtk/extensions/extension_popup_gtk.h" |
| (...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 555 NotificationService::current()->Notify( | 556 NotificationService::current()->Notify( |
| 556 NotificationType::ACCESSIBILITY_CONTROL_FOCUSED, | 557 NotificationType::ACCESSIBILITY_CONTROL_FOCUSED, |
| 557 Source<Profile>(profile_), | 558 Source<Profile>(profile_), |
| 558 Details<AccessibilityTextBoxInfo>(&info)); | 559 Details<AccessibilityTextBoxInfo>(&info)); |
| 559 | 560 |
| 560 // Update the keyword and search hint states. | 561 // Update the keyword and search hint states. |
| 561 OnChanged(); | 562 OnChanged(); |
| 562 } | 563 } |
| 563 | 564 |
| 564 SkBitmap LocationBarViewGtk::GetFavicon() const { | 565 SkBitmap LocationBarViewGtk::GetFavicon() const { |
| 565 return GetTabContents()->GetFavicon(); | 566 return GetTabContentsWrapper()->favicon_tab_helper()->GetFavicon(); |
| 566 } | 567 } |
| 567 | 568 |
| 568 string16 LocationBarViewGtk::GetTitle() const { | 569 string16 LocationBarViewGtk::GetTitle() const { |
| 569 return GetTabContents()->GetTitle(); | 570 return GetTabContents()->GetTitle(); |
| 570 } | 571 } |
| 571 | 572 |
| 572 InstantController* LocationBarViewGtk::GetInstant() { | 573 InstantController* LocationBarViewGtk::GetInstant() { |
| 573 return browser_->instant(); | 574 return browser_->instant(); |
| 574 } | 575 } |
| 575 | 576 |
| 576 TabContentsWrapper* LocationBarViewGtk::GetTabContentsWrapper() { | 577 TabContentsWrapper* LocationBarViewGtk::GetTabContentsWrapper() const { |
| 577 return browser_->GetSelectedTabContentsWrapper(); | 578 return browser_->GetSelectedTabContentsWrapper(); |
| 578 } | 579 } |
| 579 | 580 |
| 580 void LocationBarViewGtk::ShowFirstRunBubble(FirstRun::BubbleType bubble_type) { | 581 void LocationBarViewGtk::ShowFirstRunBubble(FirstRun::BubbleType bubble_type) { |
| 581 // We need the browser window to be shown before we can show the bubble, but | 582 // We need the browser window to be shown before we can show the bubble, but |
| 582 // we get called before that's happened. | 583 // we get called before that's happened. |
| 583 Task* task = first_run_bubble_.NewRunnableMethod( | 584 Task* task = first_run_bubble_.NewRunnableMethod( |
| 584 &LocationBarViewGtk::ShowFirstRunBubbleInternal, bubble_type); | 585 &LocationBarViewGtk::ShowFirstRunBubbleInternal, bubble_type); |
| 585 MessageLoop::current()->PostTask(FROM_HERE, task); | 586 MessageLoop::current()->PostTask(FROM_HERE, task); |
| 586 } | 587 } |
| (...skipping 1039 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1626 | 1627 |
| 1627 std::string badge_text = page_action_->GetBadgeText(tab_id); | 1628 std::string badge_text = page_action_->GetBadgeText(tab_id); |
| 1628 if (badge_text.empty()) | 1629 if (badge_text.empty()) |
| 1629 return FALSE; | 1630 return FALSE; |
| 1630 | 1631 |
| 1631 gfx::CanvasSkiaPaint canvas(event, false); | 1632 gfx::CanvasSkiaPaint canvas(event, false); |
| 1632 gfx::Rect bounding_rect(widget->allocation); | 1633 gfx::Rect bounding_rect(widget->allocation); |
| 1633 page_action_->PaintBadge(&canvas, bounding_rect, tab_id); | 1634 page_action_->PaintBadge(&canvas, bounding_rect, tab_id); |
| 1634 return FALSE; | 1635 return FALSE; |
| 1635 } | 1636 } |
| OLD | NEW |