Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(140)

Side by Side Diff: chrome/browser/gtk/browser_window_gtk.cc

Issue 3011007: Nukes the nano tab style on gtk and brings back the toolbar for apps (Closed)
Patch Set: Created 10 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/gtk/browser_window_gtk.h" 5 #include "chrome/browser/gtk/browser_window_gtk.h"
6 6
7 #include <gdk/gdkkeysyms.h> 7 #include <gdk/gdkkeysyms.h>
8 8
9 #include <string> 9 #include <string>
10 10
(...skipping 845 matching lines...) Expand 10 before | Expand all | Expand 10 after
856 856
857 void BrowserWindowGtk::FocusChromeOSStatus() { 857 void BrowserWindowGtk::FocusChromeOSStatus() {
858 NOTIMPLEMENTED(); 858 NOTIMPLEMENTED();
859 } 859 }
860 860
861 void BrowserWindowGtk::RotatePaneFocus(bool forwards) { 861 void BrowserWindowGtk::RotatePaneFocus(bool forwards) {
862 NOTIMPLEMENTED(); 862 NOTIMPLEMENTED();
863 } 863 }
864 864
865 bool BrowserWindowGtk::IsBookmarkBarVisible() const { 865 bool BrowserWindowGtk::IsBookmarkBarVisible() const {
866 return IsBookmarkBarSupported() && bookmark_bar_.get() && 866 return browser_->SupportsWindowFeature(Browser::FEATURE_BOOKMARKBAR) &&
867 bookmark_bar_.get() &&
867 browser_->profile()->GetPrefs()->GetBoolean(prefs::kShowBookmarkBar); 868 browser_->profile()->GetPrefs()->GetBoolean(prefs::kShowBookmarkBar);
868 } 869 }
869 870
870 bool BrowserWindowGtk::IsBookmarkBarAnimating() const { 871 bool BrowserWindowGtk::IsBookmarkBarAnimating() const {
871 if (IsBookmarkBarSupported() && bookmark_bar_->IsAnimating()) 872 if (IsBookmarkBarSupported() && bookmark_bar_->IsAnimating())
872 return true; 873 return true;
873 return false; 874 return false;
874 } 875 }
875 876
876 bool BrowserWindowGtk::IsToolbarVisible() const { 877 bool BrowserWindowGtk::IsToolbarVisible() const {
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
1106 } 1107 }
1107 1108
1108 void BrowserWindowGtk::Copy() { 1109 void BrowserWindowGtk::Copy() {
1109 DoCutCopyPaste(this, &RenderViewHost::Copy, "copy-clipboard"); 1110 DoCutCopyPaste(this, &RenderViewHost::Copy, "copy-clipboard");
1110 } 1111 }
1111 1112
1112 void BrowserWindowGtk::Paste() { 1113 void BrowserWindowGtk::Paste() {
1113 DoCutCopyPaste(this, &RenderViewHost::Paste, "paste-clipboard"); 1114 DoCutCopyPaste(this, &RenderViewHost::Paste, "paste-clipboard");
1114 } 1115 }
1115 1116
1116 void BrowserWindowGtk::SetToolbarCollapsedMode(bool val) {
1117 toolbar_->set_collapsed(val);
1118 }
1119
1120 void BrowserWindowGtk::ConfirmBrowserCloseWithPendingDownloads() { 1117 void BrowserWindowGtk::ConfirmBrowserCloseWithPendingDownloads() {
1121 new DownloadInProgressDialogGtk(browser()); 1118 new DownloadInProgressDialogGtk(browser());
1122 } 1119 }
1123 1120
1124 void BrowserWindowGtk::Observe(NotificationType type, 1121 void BrowserWindowGtk::Observe(NotificationType type,
1125 const NotificationSource& source, 1122 const NotificationSource& source,
1126 const NotificationDetails& details) { 1123 const NotificationDetails& details) {
1127 switch (type.value) { 1124 switch (type.value) {
1128 case NotificationType::BOOKMARK_BAR_VISIBILITY_PREF_CHANGED: 1125 case NotificationType::BOOKMARK_BAR_VISIBILITY_PREF_CHANGED:
1129 MaybeShowBookmarkBar(browser_->GetSelectedTabContents(), true); 1126 MaybeShowBookmarkBar(browser_->GetSelectedTabContents(), true);
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
1211 gdk_window_invalidate_rect(GTK_WIDGET(window_)->window, 1208 gdk_window_invalidate_rect(GTK_WIDGET(window_)->window,
1212 &GTK_WIDGET(window_)->allocation, TRUE); 1209 &GTK_WIDGET(window_)->allocation, TRUE);
1213 // For some reason, the above two calls cause the window shape to be 1210 // For some reason, the above two calls cause the window shape to be
1214 // lost so reset it. 1211 // lost so reset it.
1215 UpdateWindowShape(bounds_.width(), bounds_.height()); 1212 UpdateWindowShape(bounds_.width(), bounds_.height());
1216 } 1213 }
1217 } 1214 }
1218 1215
1219 void BrowserWindowGtk::MaybeShowBookmarkBar(TabContents* contents, 1216 void BrowserWindowGtk::MaybeShowBookmarkBar(TabContents* contents,
1220 bool animate) { 1217 bool animate) {
1221 if (!IsBookmarkBarSupported()) { 1218 if (!IsBookmarkBarSupported())
1222 // Because the bookmark bar is never shown in app tab windows, we must
1223 // explicitly hide to handle the case of switching tabs.
1224 if (bookmark_bar_.get())
1225 bookmark_bar_->Hide(false); // animate
1226 return; 1219 return;
1227 }
1228 1220
1229 bool show_bar = false; 1221 bool show_bar = false;
1230 1222
1231 if (contents) { 1223 if (IsBookmarkBarSupported() && contents) {
1232 bookmark_bar_->SetProfile(contents->profile()); 1224 bookmark_bar_->SetProfile(contents->profile());
1233 bookmark_bar_->SetPageNavigator(contents); 1225 bookmark_bar_->SetPageNavigator(contents);
1234 show_bar = true; 1226 show_bar = true;
1235 } 1227 }
1236 1228
1237 if (show_bar && contents && !contents->ShouldShowBookmarkBar()) { 1229 if (show_bar && contents && !contents->ShouldShowBookmarkBar()) {
1238 PrefService* prefs = contents->profile()->GetPrefs(); 1230 PrefService* prefs = contents->profile()->GetPrefs();
1239 show_bar = prefs->GetBoolean(prefs::kShowBookmarkBar) && !IsFullscreen(); 1231 show_bar = prefs->GetBoolean(prefs::kShowBookmarkBar) && !IsFullscreen();
1240 } 1232 }
1241 1233
(...skipping 791 matching lines...) Expand 10 before | Expand all | Expand 10 after
2033 toolbar_->Hide(); 2025 toolbar_->Hide();
2034 2026
2035 // If the bookmark bar shelf is unsupported, then we never create it. 2027 // If the bookmark bar shelf is unsupported, then we never create it.
2036 } 2028 }
2037 2029
2038 bool BrowserWindowGtk::IsTabStripSupported() const { 2030 bool BrowserWindowGtk::IsTabStripSupported() const {
2039 return browser_->SupportsWindowFeature(Browser::FEATURE_TABSTRIP); 2031 return browser_->SupportsWindowFeature(Browser::FEATURE_TABSTRIP);
2040 } 2032 }
2041 2033
2042 bool BrowserWindowGtk::IsToolbarSupported() const { 2034 bool BrowserWindowGtk::IsToolbarSupported() const {
2043 return !toolbar_->collapsed() && 2035 return browser_->SupportsWindowFeature(Browser::FEATURE_TOOLBAR) ||
2044 (browser_->SupportsWindowFeature(Browser::FEATURE_TOOLBAR) || 2036 browser_->SupportsWindowFeature(Browser::FEATURE_LOCATIONBAR);
2045 browser_->SupportsWindowFeature(Browser::FEATURE_LOCATIONBAR));
2046 } 2037 }
2047 2038
2048 bool BrowserWindowGtk::IsBookmarkBarSupported() const { 2039 bool BrowserWindowGtk::IsBookmarkBarSupported() const {
2049 // We never show the bookmark bar on app tab pages.
2050 if (bookmark_bar_.get() && bookmark_bar_->OnAppsPage())
2051 return false;
2052
2053 return browser_->SupportsWindowFeature(Browser::FEATURE_BOOKMARKBAR); 2040 return browser_->SupportsWindowFeature(Browser::FEATURE_BOOKMARKBAR);
2054 } 2041 }
2055 2042
2056 bool BrowserWindowGtk::UsingCustomPopupFrame() const { 2043 bool BrowserWindowGtk::UsingCustomPopupFrame() const {
2057 GtkThemeProvider* theme_provider = GtkThemeProvider::GetFrom( 2044 GtkThemeProvider* theme_provider = GtkThemeProvider::GetFrom(
2058 browser()->profile()); 2045 browser()->profile());
2059 return !theme_provider->UseGtkTheme() && 2046 return !theme_provider->UseGtkTheme() &&
2060 browser()->type() & Browser::TYPE_POPUP; 2047 browser()->type() & Browser::TYPE_POPUP;
2061 } 2048 }
2062 2049
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
2158 // special-case the ones where the custom frame should be used. These names 2145 // special-case the ones where the custom frame should be used. These names
2159 // are taken from the WMs' source code. 2146 // are taken from the WMs' source code.
2160 return (wm_name == "Blackbox" || 2147 return (wm_name == "Blackbox" ||
2161 wm_name == "compiz" || 2148 wm_name == "compiz" ||
2162 wm_name == "e16" || // Enlightenment DR16 2149 wm_name == "e16" || // Enlightenment DR16
2163 wm_name == "Metacity" || 2150 wm_name == "Metacity" ||
2164 wm_name == "Mutter" || 2151 wm_name == "Mutter" ||
2165 wm_name == "Openbox" || 2152 wm_name == "Openbox" ||
2166 wm_name == "Xfwm4"); 2153 wm_name == "Xfwm4");
2167 } 2154 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698