| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 #include "ui/base/dragdrop/gtk_dnd_util.h" | 85 #include "ui/base/dragdrop/gtk_dnd_util.h" |
| 86 #include "ui/base/gtk/gtk_hig_constants.h" | 86 #include "ui/base/gtk/gtk_hig_constants.h" |
| 87 #include "ui/base/gtk/gtk_signal_registrar.h" | 87 #include "ui/base/gtk/gtk_signal_registrar.h" |
| 88 #include "ui/base/l10n/l10n_util.h" | 88 #include "ui/base/l10n/l10n_util.h" |
| 89 #include "ui/base/resource/resource_bundle.h" | 89 #include "ui/base/resource/resource_bundle.h" |
| 90 #include "ui/base/window_open_disposition.h" | 90 #include "ui/base/window_open_disposition.h" |
| 91 #include "ui/gfx/canvas_skia_paint.h" | 91 #include "ui/gfx/canvas_skia_paint.h" |
| 92 #include "ui/gfx/font.h" | 92 #include "ui/gfx/font.h" |
| 93 #include "ui/gfx/gtk_util.h" | 93 #include "ui/gfx/gtk_util.h" |
| 94 #include "ui/gfx/image/image.h" | 94 #include "ui/gfx/image/image.h" |
| 95 #include "ui/gfx/rect.h" | |
| 96 | 95 |
| 97 using content::NavigationEntry; | 96 using content::NavigationEntry; |
| 98 using content::OpenURLParams; | 97 using content::OpenURLParams; |
| 99 using content::WebContents; | 98 using content::WebContents; |
| 100 using extensions::LocationBarController; | 99 using extensions::LocationBarController; |
| 101 using extensions::Extension; | 100 using extensions::Extension; |
| 102 | 101 |
| 103 namespace { | 102 namespace { |
| 104 | 103 |
| 105 // We are positioned with a little bit of extra space that we don't use now. | 104 // We are positioned with a little bit of extra space that we don't use now. |
| (...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 611 ui::SetSourceTargetListFromCodeMask(site_type_event_box_, | 610 ui::SetSourceTargetListFromCodeMask(site_type_event_box_, |
| 612 ui::TEXT_PLAIN | | 611 ui::TEXT_PLAIN | |
| 613 ui::TEXT_URI_LIST | | 612 ui::TEXT_URI_LIST | |
| 614 ui::CHROME_NAMED_URL); | 613 ui::CHROME_NAMED_URL); |
| 615 } | 614 } |
| 616 | 615 |
| 617 WebContents* LocationBarViewGtk::GetWebContents() const { | 616 WebContents* LocationBarViewGtk::GetWebContents() const { |
| 618 return browser_->tab_strip_model()->GetActiveWebContents(); | 617 return browser_->tab_strip_model()->GetActiveWebContents(); |
| 619 } | 618 } |
| 620 | 619 |
| 621 gfx::Rect LocationBarViewGtk::GetOmniboxBounds() const { | |
| 622 GtkAllocation hbox_allocation; | |
| 623 gtk_widget_get_allocation(hbox_.get(), &hbox_allocation); | |
| 624 return AllocationToRect(hbox_allocation); | |
| 625 } | |
| 626 | |
| 627 void LocationBarViewGtk::SetPreviewEnabledPageAction( | 620 void LocationBarViewGtk::SetPreviewEnabledPageAction( |
| 628 ExtensionAction* page_action, | 621 ExtensionAction* page_action, |
| 629 bool preview_enabled) { | 622 bool preview_enabled) { |
| 630 DCHECK(page_action); | 623 DCHECK(page_action); |
| 631 for (ScopedVector<PageActionViewGtk>::iterator iter = | 624 for (ScopedVector<PageActionViewGtk>::iterator iter = |
| 632 page_action_views_.begin(); iter != page_action_views_.end(); | 625 page_action_views_.begin(); iter != page_action_views_.end(); |
| 633 ++iter) { | 626 ++iter) { |
| 634 if ((*iter)->page_action() == page_action) { | 627 if ((*iter)->page_action() == page_action) { |
| 635 (*iter)->set_preview_enabled(preview_enabled); | 628 (*iter)->set_preview_enabled(preview_enabled); |
| 636 UpdatePageActions(); | 629 UpdatePageActions(); |
| (...skipping 1486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2123 } | 2116 } |
| 2124 | 2117 |
| 2125 void LocationBarViewGtk::PageActionViewGtk::InspectPopup( | 2118 void LocationBarViewGtk::PageActionViewGtk::InspectPopup( |
| 2126 ExtensionAction* action) { | 2119 ExtensionAction* action) { |
| 2127 ExtensionPopupGtk::Show( | 2120 ExtensionPopupGtk::Show( |
| 2128 action->GetPopupUrl(current_tab_id_), | 2121 action->GetPopupUrl(current_tab_id_), |
| 2129 owner_->browser_, | 2122 owner_->browser_, |
| 2130 event_box_.get(), | 2123 event_box_.get(), |
| 2131 ExtensionPopupGtk::SHOW_AND_INSPECT); | 2124 ExtensionPopupGtk::SHOW_AND_INSPECT); |
| 2132 } | 2125 } |
| OLD | NEW |