Chromium Code Reviews| 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 541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 552 // This offset corrects the strange offset of CustomDrawButton. | 552 // This offset corrects the strange offset of CustomDrawButton. |
| 553 const int kMagicActionBoxYOffset = 3; | 553 const int kMagicActionBoxYOffset = 3; |
| 554 GtkWidget* alignment = gtk_alignment_new(0, 0, 1, 1); | 554 GtkWidget* alignment = gtk_alignment_new(0, 0, 1, 1); |
| 555 gtk_alignment_set_padding(GTK_ALIGNMENT(alignment), | 555 gtk_alignment_set_padding(GTK_ALIGNMENT(alignment), |
| 556 0, kMagicActionBoxYOffset, | 556 0, kMagicActionBoxYOffset, |
| 557 0, kInnerPadding); | 557 0, kInnerPadding); |
| 558 gtk_container_add(GTK_CONTAINER(alignment), action_box_button_->widget()); | 558 gtk_container_add(GTK_CONTAINER(alignment), action_box_button_->widget()); |
| 559 | 559 |
| 560 gtk_box_pack_end(GTK_BOX(hbox_.get()), alignment, | 560 gtk_box_pack_end(GTK_BOX(hbox_.get()), alignment, |
| 561 FALSE, FALSE, 0); | 561 FALSE, FALSE, 0); |
| 562 } else if (browser_defaults::bookmarks_enabled && !ShouldOnlyShowLocation()) { | 562 } |
| 563 | |
| 564 if (browser_defaults::bookmarks_enabled && !ShouldOnlyShowLocation()) { | |
| 563 // Hide the star and Chrome To Mobile icons in popups, app windows, etc. | 565 // Hide the star and Chrome To Mobile icons in popups, app windows, etc. |
| 564 CreateStarButton(); | 566 CreateStarButton(); |
| 565 gtk_box_pack_end(GTK_BOX(hbox_.get()), star_.get(), FALSE, FALSE, 0); | 567 gtk_box_pack_end(GTK_BOX(hbox_.get()), star_.get(), FALSE, FALSE, 0); |
| 566 | 568 |
| 567 // Disable Chrome To Mobile for off-the-record and non-synced profiles, | 569 // Disable Chrome To Mobile for off-the-record and non-synced profiles, |
| 568 // or if the feature is disabled by a command line flag or chrome://flags. | 570 // or if the feature is disabled by a command line flag or chrome://flags. |
| 569 if (!profile->IsOffTheRecord() && profile->IsSyncAccessible() && | 571 if (!profile->IsOffTheRecord() && profile->IsSyncAccessible() && |
| 570 ChromeToMobileService::IsChromeToMobileEnabled()) { | 572 ChromeToMobileService::IsChromeToMobileEnabled()) { |
| 571 CreateChromeToMobileButton(); | 573 CreateChromeToMobileButton(); |
| 572 gtk_box_pack_end(GTK_BOX(hbox_.get()), chrome_to_mobile_view_.get(), | 574 gtk_box_pack_end(GTK_BOX(hbox_.get()), chrome_to_mobile_view_.get(), |
| (...skipping 989 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1562 | 1564 |
| 1563 gtk_widget_show(zoom_.get()); | 1565 gtk_widget_show(zoom_.get()); |
| 1564 } | 1566 } |
| 1565 | 1567 |
| 1566 void LocationBarViewGtk::UpdateStarIcon() { | 1568 void LocationBarViewGtk::UpdateStarIcon() { |
| 1567 if (!star_.get()) | 1569 if (!star_.get()) |
| 1568 return; | 1570 return; |
| 1569 bool star_enabled = !toolbar_model_->input_in_progress() && | 1571 bool star_enabled = !toolbar_model_->input_in_progress() && |
| 1570 edit_bookmarks_enabled_.GetValue(); | 1572 edit_bookmarks_enabled_.GetValue(); |
| 1571 command_updater_->UpdateCommandEnabled(IDC_BOOKMARK_PAGE, star_enabled); | 1573 command_updater_->UpdateCommandEnabled(IDC_BOOKMARK_PAGE, star_enabled); |
| 1572 if (star_enabled) { | 1574 |
| 1575 bool visible = star_enabled; | |
|
msw
2012/08/30 03:39:22
nit: mutate |star_enabled| (after UpdateCommandEna
beaudoin
2012/08/30 20:55:05
Done.
| |
| 1576 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableActionBox) && | |
| 1577 !starred_) | |
| 1578 visible = false; | |
| 1579 if (visible) { | |
| 1580 int id = starred_ ? IDR_STAR_LIT : IDR_STAR; | |
| 1581 gtk_image_set_from_pixbuf(GTK_IMAGE(star_image_), | |
| 1582 theme_service_->GetImageNamed(id)->ToGdkPixbuf()); | |
| 1573 gtk_widget_show_all(star_.get()); | 1583 gtk_widget_show_all(star_.get()); |
|
msw
2012/08/30 03:39:22
nit: any reason to re-order this after the two pre
beaudoin
2012/08/30 20:55:05
Probably left-over from my experimentations. :)
D
| |
| 1574 int id = starred_ ? IDR_STAR_LIT : IDR_STAR; | |
| 1575 gtk_image_set_from_pixbuf( | |
| 1576 GTK_IMAGE(star_image_), | |
| 1577 theme_service_->GetImageNamed(id)->ToGdkPixbuf()); | |
| 1578 } else { | 1584 } else { |
| 1579 gtk_widget_hide_all(star_.get()); | 1585 gtk_widget_hide_all(star_.get()); |
| 1580 } | 1586 } |
| 1581 } | 1587 } |
| 1582 | 1588 |
| 1583 void LocationBarViewGtk::UpdateChromeToMobileIcon() { | 1589 void LocationBarViewGtk::UpdateChromeToMobileIcon() { |
| 1584 if (!chrome_to_mobile_view_.get()) | 1590 if (!chrome_to_mobile_view_.get()) |
| 1585 return; | 1591 return; |
| 1586 | 1592 |
| 1587 Profile* profile = browser_->profile(); | 1593 Profile* profile = browser_->profile(); |
| (...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2134 } | 2140 } |
| 2135 | 2141 |
| 2136 void LocationBarViewGtk::PageActionViewGtk::InspectPopup( | 2142 void LocationBarViewGtk::PageActionViewGtk::InspectPopup( |
| 2137 ExtensionAction* action) { | 2143 ExtensionAction* action) { |
| 2138 ExtensionPopupGtk::Show( | 2144 ExtensionPopupGtk::Show( |
| 2139 action->GetPopupUrl(current_tab_id_), | 2145 action->GetPopupUrl(current_tab_id_), |
| 2140 owner_->browser_, | 2146 owner_->browser_, |
| 2141 event_box_.get(), | 2147 event_box_.get(), |
| 2142 ExtensionPopupGtk::SHOW_AND_INSPECT); | 2148 ExtensionPopupGtk::SHOW_AND_INSPECT); |
| 2143 } | 2149 } |
| OLD | NEW |