| 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 707 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 718 ++iter) { | 718 ++iter) { |
| 719 if ((*iter)->page_action() == page_action) | 719 if ((*iter)->page_action() == page_action) |
| 720 return (*iter)->widget(); | 720 return (*iter)->widget(); |
| 721 } | 721 } |
| 722 return NULL; | 722 return NULL; |
| 723 } | 723 } |
| 724 | 724 |
| 725 void LocationBarViewGtk::Update(const WebContents* contents) { | 725 void LocationBarViewGtk::Update(const WebContents* contents) { |
| 726 UpdateZoomIcon(); | 726 UpdateZoomIcon(); |
| 727 UpdateStarIcon(); | 727 UpdateStarIcon(); |
| 728 UpdateChromeToMobileState(); |
| 728 UpdateSiteTypeArea(); | 729 UpdateSiteTypeArea(); |
| 729 UpdateContentSettingsIcons(); | 730 UpdateContentSettingsIcons(); |
| 730 UpdatePageActions(); | 731 UpdatePageActions(); |
| 731 UpdateWebIntentsButton(); | 732 UpdateWebIntentsButton(); |
| 732 location_entry_->Update(contents); | 733 location_entry_->Update(contents); |
| 733 // The security level (background color) could have changed, etc. | 734 // The security level (background color) could have changed, etc. |
| 734 if (theme_service_->UsingNativeTheme()) { | 735 if (theme_service_->UsingNativeTheme()) { |
| 735 // In GTK mode, we need our parent to redraw, as it draws the text entry | 736 // In GTK mode, we need our parent to redraw, as it draws the text entry |
| 736 // border. | 737 // border. |
| 737 gtk_widget_queue_draw(gtk_widget_get_parent(widget())); | 738 gtk_widget_queue_draw(gtk_widget_get_parent(widget())); |
| (...skipping 761 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1499 BookmarkBubbleGtk::Show(star_.get(), browser_->profile(), url, | 1500 BookmarkBubbleGtk::Show(star_.get(), browser_->profile(), url, |
| 1500 newly_bookmarked); | 1501 newly_bookmarked); |
| 1501 } else { | 1502 } else { |
| 1502 on_star_sized_ = base::Bind(&BookmarkBubbleGtk::Show, | 1503 on_star_sized_ = base::Bind(&BookmarkBubbleGtk::Show, |
| 1503 star_.get(), browser_->profile(), | 1504 star_.get(), browser_->profile(), |
| 1504 url, newly_bookmarked); | 1505 url, newly_bookmarked); |
| 1505 } | 1506 } |
| 1506 } | 1507 } |
| 1507 | 1508 |
| 1508 void LocationBarViewGtk::ShowChromeToMobileBubble() { | 1509 void LocationBarViewGtk::ShowChromeToMobileBubble() { |
| 1509 // TODO(msw): Chrome to Mobile is currently disabled on GTK. | 1510 ChromeToMobileBubbleGtk::Show(action_box_button_->widget(), browser_); |
| 1510 // ChromeToMobileBubbleGtk::Show(GTK_WIDGET(action_box_button_->widget()), | |
| 1511 // browser_); | |
| 1512 } | 1511 } |
| 1513 | 1512 |
| 1514 void LocationBarViewGtk::SetStarred(bool starred) { | 1513 void LocationBarViewGtk::SetStarred(bool starred) { |
| 1515 if (starred == starred_) | 1514 if (starred == starred_) |
| 1516 return; | 1515 return; |
| 1517 | 1516 |
| 1518 starred_ = starred; | 1517 starred_ = starred; |
| 1519 UpdateStarIcon(); | 1518 UpdateStarIcon(); |
| 1520 } | 1519 } |
| 1521 | 1520 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1565 if (star_enabled) { | 1564 if (star_enabled) { |
| 1566 gtk_widget_show_all(star_.get()); | 1565 gtk_widget_show_all(star_.get()); |
| 1567 int id = starred_ ? IDR_STAR_LIT : IDR_STAR; | 1566 int id = starred_ ? IDR_STAR_LIT : IDR_STAR; |
| 1568 gtk_image_set_from_pixbuf(GTK_IMAGE(star_image_), | 1567 gtk_image_set_from_pixbuf(GTK_IMAGE(star_image_), |
| 1569 theme_service_->GetImageNamed(id)->ToGdkPixbuf()); | 1568 theme_service_->GetImageNamed(id)->ToGdkPixbuf()); |
| 1570 } else { | 1569 } else { |
| 1571 gtk_widget_hide_all(star_.get()); | 1570 gtk_widget_hide_all(star_.get()); |
| 1572 } | 1571 } |
| 1573 } | 1572 } |
| 1574 | 1573 |
| 1574 void LocationBarViewGtk::UpdateChromeToMobileState() { |
| 1575 ChromeToMobileService* service = |
| 1576 ChromeToMobileServiceFactory::GetForProfile(browser()->profile()); |
| 1577 command_updater_->UpdateCommandEnabled(IDC_CHROME_TO_MOBILE_PAGE, |
| 1578 !toolbar_model_->input_in_progress() && service && service->HasMobiles()); |
| 1579 } |
| 1580 |
| 1575 bool LocationBarViewGtk::ShouldOnlyShowLocation() { | 1581 bool LocationBarViewGtk::ShouldOnlyShowLocation() { |
| 1576 return !browser_->is_type_tabbed(); | 1582 return !browser_->is_type_tabbed(); |
| 1577 } | 1583 } |
| 1578 | 1584 |
| 1579 void LocationBarViewGtk::AdjustChildrenVisibility() { | 1585 void LocationBarViewGtk::AdjustChildrenVisibility() { |
| 1580 int text_width = location_entry_->TextWidth(); | 1586 int text_width = location_entry_->TextWidth(); |
| 1581 int available_width = entry_box_width_ - text_width - kInnerPadding; | 1587 int available_width = entry_box_width_ - text_width - kInnerPadding; |
| 1582 | 1588 |
| 1583 // Only one of |tab_to_search_alignment_| and |tab_to_search_hint_| can be | 1589 // Only one of |tab_to_search_alignment_| and |tab_to_search_hint_| can be |
| 1584 // visible at the same time. | 1590 // visible at the same time. |
| (...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2109 } | 2115 } |
| 2110 | 2116 |
| 2111 void LocationBarViewGtk::PageActionViewGtk::InspectPopup( | 2117 void LocationBarViewGtk::PageActionViewGtk::InspectPopup( |
| 2112 ExtensionAction* action) { | 2118 ExtensionAction* action) { |
| 2113 ExtensionPopupGtk::Show( | 2119 ExtensionPopupGtk::Show( |
| 2114 action->GetPopupUrl(current_tab_id_), | 2120 action->GetPopupUrl(current_tab_id_), |
| 2115 owner_->browser_, | 2121 owner_->browser_, |
| 2116 event_box_.get(), | 2122 event_box_.get(), |
| 2117 ExtensionPopupGtk::SHOW_AND_INSPECT); | 2123 ExtensionPopupGtk::SHOW_AND_INSPECT); |
| 2118 } | 2124 } |
| OLD | NEW |