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/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() ? ui::HIDE_TITLEBAR_WHEN_MAXIMIZED |
| 1200 break; | 1200 : ui::SHOW_TITLEBAR_WHEN_MAXIMIZED); |
|
Mattias Nissler (ping if slow)
2012/10/31 13:29:36
indentation
Jói
2012/10/31 14:56:26
Done.
| |
| 1201 } | 1201 } else { |
| 1202 case chrome::NOTIFICATION_PROFILE_CACHED_INFO_CHANGED: | 1202 NOTREACHED() << "Got pref change notification we didn't register for!"; |
| 1203 // The profile avatar icon may have changed. | |
| 1204 gtk_util::SetWindowIcon(window_, browser_->profile()); | |
| 1205 break; | |
| 1206 default: | |
| 1207 break; | |
| 1208 } | 1203 } |
| 1209 } | 1204 } |
| 1210 | 1205 |
| 1211 void BrowserWindowGtk::TabDetachedAt(TabContents* contents, int index) { | 1206 void BrowserWindowGtk::TabDetachedAt(TabContents* contents, int index) { |
| 1212 // We use index here rather than comparing |contents| because by this time | 1207 // We use index here rather than comparing |contents| because by this time |
| 1213 // the model has already removed |contents| from its list, so | 1208 // the model has already removed |contents| from its list, so |
| 1214 // chrome::GetActiveWebContents(browser_.get()) will return NULL or something | 1209 // chrome::GetActiveWebContents(browser_.get()) will return NULL or something |
| 1215 // else. | 1210 // else. |
| 1216 if (index == browser_->active_index()) { | 1211 if (index == browser_->active_index()) { |
| 1217 infobar_container_->ChangeTabContents(NULL); | 1212 infobar_container_->ChangeTabContents(NULL); |
| (...skipping 1207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2425 wm_type == ui::WM_OPENBOX || | 2420 wm_type == ui::WM_OPENBOX || |
| 2426 wm_type == ui::WM_XFWM4); | 2421 wm_type == ui::WM_XFWM4); |
| 2427 } | 2422 } |
| 2428 | 2423 |
| 2429 // static | 2424 // static |
| 2430 BrowserWindow* BrowserWindow::CreateBrowserWindow(Browser* browser) { | 2425 BrowserWindow* BrowserWindow::CreateBrowserWindow(Browser* browser) { |
| 2431 BrowserWindowGtk* browser_window_gtk = new BrowserWindowGtk(browser); | 2426 BrowserWindowGtk* browser_window_gtk = new BrowserWindowGtk(browser); |
| 2432 browser_window_gtk->Init(); | 2427 browser_window_gtk->Init(); |
| 2433 return browser_window_gtk; | 2428 return browser_window_gtk; |
| 2434 } | 2429 } |
| OLD | NEW |