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