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/browser_window_gtk.h" | 5 #include "chrome/browser/ui/gtk/browser_window_gtk.h" |
6 | 6 |
7 #include <gdk/gdkkeysyms.h> | 7 #include <gdk/gdkkeysyms.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <string> | 10 #include <string> |
(...skipping 1167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1178 new PasswordGenerationBubbleGtk(rect, form, tab_contents, password_generator); | 1178 new PasswordGenerationBubbleGtk(rect, form, tab_contents, password_generator); |
1179 } | 1179 } |
1180 | 1180 |
1181 void BrowserWindowGtk::ConfirmBrowserCloseWithPendingDownloads() { | 1181 void BrowserWindowGtk::ConfirmBrowserCloseWithPendingDownloads() { |
1182 DownloadInProgressDialogGtk::Show(browser(), GetNativeWindow()); | 1182 DownloadInProgressDialogGtk::Show(browser(), GetNativeWindow()); |
1183 } | 1183 } |
1184 | 1184 |
1185 void BrowserWindowGtk::Observe(int type, | 1185 void BrowserWindowGtk::Observe(int type, |
1186 const content::NotificationSource& source, | 1186 const content::NotificationSource& source, |
1187 const content::NotificationDetails& details) { | 1187 const content::NotificationDetails& details) { |
1188 switch (type) { | 1188 DCHECK_EQ(chrome::NOTIFICATION_PROFILE_CACHED_INFO_CHANGED, type); |
1189 case chrome::NOTIFICATION_PREF_CHANGED: { | 1189 // The profile avatar icon may have changed. |
1190 std::string* pref_name = content::Details<std::string>(details).ptr(); | 1190 gtk_util::SetWindowIcon(window_, browser_->profile()); |
1191 if (*pref_name == prefs::kUseCustomChromeFrame) { | 1191 } |
1192 UpdateCustomFrame(); | 1192 |
1193 ui::SetHideTitlebarWhenMaximizedProperty( | 1193 void BrowserWindowGtk::OnPreferenceChanged(PrefServiceBase* service, |
1194 ui::GetX11WindowFromGtkWidget(GTK_WIDGET(window_)), | 1194 const std::string& pref_name) { |
1195 UseCustomFrame() ? ui::HIDE_TITLEBAR_WHEN_MAXIMIZED | 1195 if (pref_name == prefs::kUseCustomChromeFrame) { |
1196 : ui::SHOW_TITLEBAR_WHEN_MAXIMIZED); | 1196 UpdateCustomFrame(); |
1197 } else { | 1197 ui::SetHideTitlebarWhenMaximizedProperty( |
1198 NOTREACHED() << "Got pref change notification we didn't register for!"; | 1198 ui::GetX11WindowFromGtkWidget(GTK_WIDGET(window_)), |
1199 } | 1199 UseCustomFrame() ? |
1200 break; | 1200 ui::HIDE_TITLEBAR_WHEN_MAXIMIZED : |
1201 } | 1201 ui::SHOW_TITLEBAR_WHEN_MAXIMIZED); |
1202 case chrome::NOTIFICATION_PROFILE_CACHED_INFO_CHANGED: | 1202 } else { |
1203 // The profile avatar icon may have changed. | 1203 NOTREACHED() << "Got pref change notification we didn't register for!"; |
1204 gtk_util::SetWindowIcon(window_, browser_->profile()); | |
1205 break; | |
1206 default: | |
1207 break; | |
1208 } | 1204 } |
1209 } | 1205 } |
1210 | 1206 |
1211 void BrowserWindowGtk::TabDetachedAt(TabContents* contents, int index) { | 1207 void BrowserWindowGtk::TabDetachedAt(TabContents* contents, int index) { |
1212 // We use index here rather than comparing |contents| because by this time | 1208 // We use index here rather than comparing |contents| because by this time |
1213 // the model has already removed |contents| from its list, so | 1209 // the model has already removed |contents| from its list, so |
1214 // chrome::GetActiveWebContents(browser_.get()) will return NULL or something | 1210 // chrome::GetActiveWebContents(browser_.get()) will return NULL or something |
1215 // else. | 1211 // else. |
1216 if (index == browser_->active_index()) { | 1212 if (index == browser_->active_index()) { |
1217 infobar_container_->ChangeTabContents(NULL); | 1213 infobar_container_->ChangeTabContents(NULL); |
(...skipping 1207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2425 wm_type == ui::WM_OPENBOX || | 2421 wm_type == ui::WM_OPENBOX || |
2426 wm_type == ui::WM_XFWM4); | 2422 wm_type == ui::WM_XFWM4); |
2427 } | 2423 } |
2428 | 2424 |
2429 // static | 2425 // static |
2430 BrowserWindow* BrowserWindow::CreateBrowserWindow(Browser* browser) { | 2426 BrowserWindow* BrowserWindow::CreateBrowserWindow(Browser* browser) { |
2431 BrowserWindowGtk* browser_window_gtk = new BrowserWindowGtk(browser); | 2427 BrowserWindowGtk* browser_window_gtk = new BrowserWindowGtk(browser); |
2432 browser_window_gtk->Init(); | 2428 browser_window_gtk->Init(); |
2433 return browser_window_gtk; | 2429 return browser_window_gtk; |
2434 } | 2430 } |
OLD | NEW |