| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 11 matching lines...) Expand all Loading... |
| 22 #include "base/nix/xdg_util.h" | 22 #include "base/nix/xdg_util.h" |
| 23 #include "base/path_service.h" | 23 #include "base/path_service.h" |
| 24 #include "base/string_util.h" | 24 #include "base/string_util.h" |
| 25 #include "base/time.h" | 25 #include "base/time.h" |
| 26 #include "base/utf_string_conversions.h" | 26 #include "base/utf_string_conversions.h" |
| 27 #include "chrome/app/chrome_command_ids.h" | 27 #include "chrome/app/chrome_command_ids.h" |
| 28 #include "chrome/browser/api/infobars/infobar_service.h" | 28 #include "chrome/browser/api/infobars/infobar_service.h" |
| 29 #include "chrome/browser/browser_process.h" | 29 #include "chrome/browser/browser_process.h" |
| 30 #include "chrome/browser/download/download_item_model.h" | 30 #include "chrome/browser/download/download_item_model.h" |
| 31 #include "chrome/browser/extensions/tab_helper.h" | 31 #include "chrome/browser/extensions/tab_helper.h" |
| 32 #include "chrome/browser/prefs/pref_registry_syncable.h" |
| 32 #include "chrome/browser/prefs/pref_service.h" | 33 #include "chrome/browser/prefs/pref_service.h" |
| 33 #include "chrome/browser/prefs/scoped_user_pref_update.h" | 34 #include "chrome/browser/prefs/scoped_user_pref_update.h" |
| 34 #include "chrome/browser/profiles/profile.h" | 35 #include "chrome/browser/profiles/profile.h" |
| 35 #include "chrome/browser/themes/theme_service.h" | 36 #include "chrome/browser/themes/theme_service.h" |
| 36 #include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog_queue.h" | 37 #include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog_queue.h" |
| 37 #include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h" | 38 #include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h" |
| 38 #include "chrome/browser/ui/bookmarks/bookmark_utils.h" | 39 #include "chrome/browser/ui/bookmarks/bookmark_utils.h" |
| 39 #include "chrome/browser/ui/browser.h" | 40 #include "chrome/browser/ui/browser.h" |
| 40 #include "chrome/browser/ui/browser_command_controller.h" | 41 #include "chrome/browser/ui/browser_command_controller.h" |
| 41 #include "chrome/browser/ui/browser_commands.h" | 42 #include "chrome/browser/ui/browser_commands.h" |
| (...skipping 1436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1478 if (!GetBrowserWindowForNativeWindow(window)) | 1479 if (!GetBrowserWindowForNativeWindow(window)) |
| 1479 return NULL; | 1480 return NULL; |
| 1480 return window; | 1481 return window; |
| 1481 } | 1482 } |
| 1482 | 1483 |
| 1483 GtkWidget* BrowserWindowGtk::titlebar_widget() const { | 1484 GtkWidget* BrowserWindowGtk::titlebar_widget() const { |
| 1484 return titlebar_->widget(); | 1485 return titlebar_->widget(); |
| 1485 } | 1486 } |
| 1486 | 1487 |
| 1487 // static | 1488 // static |
| 1488 void BrowserWindowGtk::RegisterUserPrefs(PrefServiceSyncable* prefs) { | 1489 void BrowserWindowGtk::RegisterUserPrefs(PrefService* prefs, |
| 1490 PrefRegistrySyncable* registry) { |
| 1491 // TODO(joi): Remove PrefService parameter. |
| 1489 bool custom_frame_default = false; | 1492 bool custom_frame_default = false; |
| 1490 // Avoid checking the window manager if we're not connected to an X server (as | 1493 // Avoid checking the window manager if we're not connected to an X server (as |
| 1491 // is the case in Valgrind tests). | 1494 // is the case in Valgrind tests). |
| 1492 if (ui::XDisplayExists() && | 1495 if (ui::XDisplayExists() && |
| 1493 !prefs->HasPrefPath(prefs::kUseCustomChromeFrame)) { | 1496 !prefs->HasPrefPath(prefs::kUseCustomChromeFrame)) { |
| 1494 custom_frame_default = GetCustomFramePrefDefault(); | 1497 custom_frame_default = GetCustomFramePrefDefault(); |
| 1495 } | 1498 } |
| 1496 prefs->RegisterBooleanPref(prefs::kUseCustomChromeFrame, | 1499 registry->RegisterBooleanPref(prefs::kUseCustomChromeFrame, |
| 1497 custom_frame_default, | 1500 custom_frame_default, |
| 1498 PrefServiceSyncable::UNSYNCABLE_PREF); | 1501 PrefRegistrySyncable::UNSYNCABLE_PREF); |
| 1499 } | 1502 } |
| 1500 | 1503 |
| 1501 WebContents* BrowserWindowGtk::GetDisplayedTab() { | 1504 WebContents* BrowserWindowGtk::GetDisplayedTab() { |
| 1502 return contents_container_->GetVisibleTab(); | 1505 return contents_container_->GetVisibleTab(); |
| 1503 } | 1506 } |
| 1504 | 1507 |
| 1505 void BrowserWindowGtk::QueueToolbarRedraw() { | 1508 void BrowserWindowGtk::QueueToolbarRedraw() { |
| 1506 gtk_widget_queue_draw(toolbar_->widget()); | 1509 gtk_widget_queue_draw(toolbar_->widget()); |
| 1507 } | 1510 } |
| 1508 | 1511 |
| (...skipping 897 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2406 wm_type == ui::WM_OPENBOX || | 2409 wm_type == ui::WM_OPENBOX || |
| 2407 wm_type == ui::WM_XFWM4); | 2410 wm_type == ui::WM_XFWM4); |
| 2408 } | 2411 } |
| 2409 | 2412 |
| 2410 // static | 2413 // static |
| 2411 BrowserWindow* BrowserWindow::CreateBrowserWindow(Browser* browser) { | 2414 BrowserWindow* BrowserWindow::CreateBrowserWindow(Browser* browser) { |
| 2412 BrowserWindowGtk* browser_window_gtk = new BrowserWindowGtk(browser); | 2415 BrowserWindowGtk* browser_window_gtk = new BrowserWindowGtk(browser); |
| 2413 browser_window_gtk->Init(); | 2416 browser_window_gtk->Init(); |
| 2414 return browser_window_gtk; | 2417 return browser_window_gtk; |
| 2415 } | 2418 } |
| OLD | NEW |