| 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/browser_toolbar_gtk.h" | 5 #include "chrome/browser/ui/gtk/browser_toolbar_gtk.h" |
| 6 | 6 |
| 7 #include <X11/XF86keysym.h> | 7 #include <X11/XF86keysym.h> |
| 8 #include <gdk/gdkkeysyms.h> | 8 #include <gdk/gdkkeysyms.h> |
| 9 #include <gtk/gtk.h> | 9 #include <gtk/gtk.h> |
| 10 | 10 |
| (...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 608 | 608 |
| 609 bool url_is_newtab = url.SchemeIs(chrome::kChromeUIScheme) && | 609 bool url_is_newtab = url.SchemeIs(chrome::kChromeUIScheme) && |
| 610 url.host() == chrome::kChromeUINewTabHost; | 610 url.host() == chrome::kChromeUINewTabHost; |
| 611 home_page_is_new_tab_page_.SetValue(url_is_newtab); | 611 home_page_is_new_tab_page_.SetValue(url_is_newtab); |
| 612 if (!url_is_newtab) | 612 if (!url_is_newtab) |
| 613 home_page_.SetValue(url.spec()); | 613 home_page_.SetValue(url.spec()); |
| 614 } | 614 } |
| 615 | 615 |
| 616 void BrowserToolbarGtk::NotifyPrefChanged(const std::string* pref) { | 616 void BrowserToolbarGtk::NotifyPrefChanged(const std::string* pref) { |
| 617 if (!pref || *pref == prefs::kShowHomeButton) { | 617 if (!pref || *pref == prefs::kShowHomeButton) { |
| 618 if (show_home_button_.GetValue() && !ShouldOnlyShowLocation()) { | 618 bool visible = show_home_button_.GetValue() && !ShouldOnlyShowLocation(); |
| 619 gtk_widget_show(home_->widget()); | 619 gtk_widget_set_visible(home_->widget(), visible); |
| 620 } else { | |
| 621 gtk_widget_hide(home_->widget()); | |
| 622 } | |
| 623 } | 620 } |
| 624 | 621 |
| 625 if (!pref || | 622 if (!pref || |
| 626 *pref == prefs::kHomePage || | 623 *pref == prefs::kHomePage || |
| 627 *pref == prefs::kHomePageIsNewTabPage) | 624 *pref == prefs::kHomePageIsNewTabPage) |
| 628 SetUpDragForHomeButton(!home_page_.IsManaged() && | 625 SetUpDragForHomeButton(!home_page_.IsManaged() && |
| 629 !home_page_is_new_tab_page_.IsManaged()); | 626 !home_page_is_new_tab_page_.IsManaged()); |
| 630 } | 627 } |
| 631 | 628 |
| 632 bool BrowserToolbarGtk::ShouldOnlyShowLocation() const { | 629 bool BrowserToolbarGtk::ShouldOnlyShowLocation() const { |
| (...skipping 17 matching lines...) Expand all Loading... |
| 650 int x_offset = base::i18n::IsRTL() ? 0 : | 647 int x_offset = base::i18n::IsRTL() ? 0 : |
| 651 sender->allocation.width - badge->width(); | 648 sender->allocation.width - badge->width(); |
| 652 int y_offset = 0; | 649 int y_offset = 0; |
| 653 canvas.DrawBitmapInt( | 650 canvas.DrawBitmapInt( |
| 654 *badge, | 651 *badge, |
| 655 sender->allocation.x + x_offset, | 652 sender->allocation.x + x_offset, |
| 656 sender->allocation.y + y_offset); | 653 sender->allocation.y + y_offset); |
| 657 | 654 |
| 658 return FALSE; | 655 return FALSE; |
| 659 } | 656 } |
| OLD | NEW |