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

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

Issue 5915006: Remove user-related data from local_state and add to user_preferences, i... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 10 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 <string> 9 #include <string>
10 10
(...skipping 1255 matching lines...) Expand 10 before | Expand all | Expand 10 after
1266 devtools_contents->ShowContents(); 1266 devtools_contents->ShowContents();
1267 } 1267 }
1268 1268
1269 bool should_show = old_devtools == NULL && devtools_contents != NULL; 1269 bool should_show = old_devtools == NULL && devtools_contents != NULL;
1270 bool should_hide = old_devtools != NULL && devtools_contents == NULL; 1270 bool should_hide = old_devtools != NULL && devtools_contents == NULL;
1271 if (should_show) { 1271 if (should_show) {
1272 gtk_widget_show(devtools_container_->widget()); 1272 gtk_widget_show(devtools_container_->widget());
1273 } else if (should_hide) { 1273 } else if (should_hide) {
1274 // Store split offset when hiding devtools window only. 1274 // Store split offset when hiding devtools window only.
1275 gint divider_offset = gtk_paned_get_position(GTK_PANED(contents_split_)); 1275 gint divider_offset = gtk_paned_get_position(GTK_PANED(contents_split_));
1276 g_browser_process->local_state()->SetInteger( 1276 browser_->profile()->GetPrefs()->
1277 prefs::kDevToolsSplitLocation, divider_offset); 1277 SetInteger(prefs::kDevToolsSplitLocation, divider_offset);
1278 gtk_widget_hide(devtools_container_->widget()); 1278 gtk_widget_hide(devtools_container_->widget());
1279 } 1279 }
1280 } 1280 }
1281 1281
1282 void BrowserWindowGtk::DestroyBrowser() { 1282 void BrowserWindowGtk::DestroyBrowser() {
1283 browser_.reset(); 1283 browser_.reset();
1284 } 1284 }
1285 1285
1286 void BrowserWindowGtk::OnBoundsChanged(const gfx::Rect& bounds) { 1286 void BrowserWindowGtk::OnBoundsChanged(const gfx::Rect& bounds) {
1287 GetLocationBar()->location_entry()->ClosePopup(); 1287 GetLocationBar()->location_entry()->ClosePopup();
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
1590 contents_container_.reset(new TabContentsContainerGtk(status_bubble_.get())); 1590 contents_container_.reset(new TabContentsContainerGtk(status_bubble_.get()));
1591 devtools_container_.reset(new TabContentsContainerGtk(NULL)); 1591 devtools_container_.reset(new TabContentsContainerGtk(NULL));
1592 ViewIDUtil::SetID(devtools_container_->widget(), VIEW_ID_DEV_TOOLS_DOCKED); 1592 ViewIDUtil::SetID(devtools_container_->widget(), VIEW_ID_DEV_TOOLS_DOCKED);
1593 contents_split_ = gtk_vpaned_new(); 1593 contents_split_ = gtk_vpaned_new();
1594 gtk_paned_pack1(GTK_PANED(contents_split_), contents_container_->widget(), 1594 gtk_paned_pack1(GTK_PANED(contents_split_), contents_container_->widget(),
1595 TRUE, TRUE); 1595 TRUE, TRUE);
1596 gtk_paned_pack2(GTK_PANED(contents_split_), devtools_container_->widget(), 1596 gtk_paned_pack2(GTK_PANED(contents_split_), devtools_container_->widget(),
1597 FALSE, TRUE); 1597 FALSE, TRUE);
1598 gtk_box_pack_end(GTK_BOX(render_area_vbox_), contents_split_, TRUE, TRUE, 0); 1598 gtk_box_pack_end(GTK_BOX(render_area_vbox_), contents_split_, TRUE, TRUE, 0);
1599 // Restore split offset. 1599 // Restore split offset.
1600 int split_offset = g_browser_process->local_state()->GetInteger( 1600 int split_offset = browser_->profile()->GetPrefs()->
1601 prefs::kDevToolsSplitLocation); 1601 GetInteger(prefs::kDevToolsSplitLocation);
1602 if (split_offset != -1) { 1602 if (split_offset != -1) {
1603 if (split_offset < kMinDevToolsHeight) 1603 if (split_offset < kMinDevToolsHeight)
1604 split_offset = kMinDevToolsHeight; 1604 split_offset = kMinDevToolsHeight;
1605 gtk_paned_set_position(GTK_PANED(contents_split_), split_offset); 1605 gtk_paned_set_position(GTK_PANED(contents_split_), split_offset);
1606 } else { 1606 } else {
1607 gtk_widget_set_size_request(devtools_container_->widget(), -1, 1607 gtk_widget_set_size_request(devtools_container_->widget(), -1,
1608 kDefaultDevToolsHeight); 1608 kDefaultDevToolsHeight);
1609 } 1609 }
1610 gtk_widget_show_all(render_area_floating_container_); 1610 gtk_widget_show_all(render_area_floating_container_);
1611 gtk_widget_hide(devtools_container_->widget()); 1611 gtk_widget_hide(devtools_container_->widget());
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
1751 } 1751 }
1752 1752
1753 void BrowserWindowGtk::SaveWindowPosition() { 1753 void BrowserWindowGtk::SaveWindowPosition() {
1754 // Browser::SaveWindowPlacement is used for session restore. 1754 // Browser::SaveWindowPlacement is used for session restore.
1755 if (browser_->ShouldSaveWindowPlacement()) 1755 if (browser_->ShouldSaveWindowPlacement())
1756 browser_->SaveWindowPlacement(restored_bounds_, IsMaximized()); 1756 browser_->SaveWindowPlacement(restored_bounds_, IsMaximized());
1757 1757
1758 // We also need to save the placement for startup. 1758 // We also need to save the placement for startup.
1759 // This is a web of calls between views and delegates on Windows, but the 1759 // This is a web of calls between views and delegates on Windows, but the
1760 // crux of the logic follows. See also cocoa/browser_window_controller.mm. 1760 // crux of the logic follows. See also cocoa/browser_window_controller.mm.
1761 if (!g_browser_process->local_state()) 1761 if (!browser_->profile()->GetPrefs())
1762 return; 1762 return;
1763 1763
1764 std::string window_name = browser_->GetWindowPlacementKey(); 1764 std::string window_name = browser_->GetWindowPlacementKey();
1765 DictionaryValue* window_preferences = 1765 DictionaryValue* window_preferences =
1766 g_browser_process->local_state()->GetMutableDictionary( 1766 browser_->profile()->GetPrefs()->
1767 window_name.c_str()); 1767 GetMutableDictionary(window_name.c_str());
1768 // Note that we store left/top for consistency with Windows, but that we 1768 // Note that we store left/top for consistency with Windows, but that we
1769 // *don't* obey them; we only use them for computing width/height. See 1769 // *don't* obey them; we only use them for computing width/height. See
1770 // comments in SetGeometryHints(). 1770 // comments in SetGeometryHints().
1771 window_preferences->SetInteger("left", restored_bounds_.x()); 1771 window_preferences->SetInteger("left", restored_bounds_.x());
1772 window_preferences->SetInteger("top", restored_bounds_.y()); 1772 window_preferences->SetInteger("top", restored_bounds_.y());
1773 window_preferences->SetInteger("right", restored_bounds_.right()); 1773 window_preferences->SetInteger("right", restored_bounds_.right());
1774 window_preferences->SetInteger("bottom", restored_bounds_.bottom()); 1774 window_preferences->SetInteger("bottom", restored_bounds_.bottom());
1775 window_preferences->SetBoolean("maximized", IsMaximized()); 1775 window_preferences->SetBoolean("maximized", IsMaximized());
1776 1776
1777 scoped_ptr<WindowSizer::MonitorInfoProvider> monitor_info_provider( 1777 scoped_ptr<WindowSizer::MonitorInfoProvider> monitor_info_provider(
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after
2244 // special-case the ones where the custom frame should be used. These names 2244 // special-case the ones where the custom frame should be used. These names
2245 // are taken from the WMs' source code. 2245 // are taken from the WMs' source code.
2246 return (wm_name == "Blackbox" || 2246 return (wm_name == "Blackbox" ||
2247 wm_name == "compiz" || 2247 wm_name == "compiz" ||
2248 wm_name == "e16" || // Enlightenment DR16 2248 wm_name == "e16" || // Enlightenment DR16
2249 wm_name == "Metacity" || 2249 wm_name == "Metacity" ||
2250 wm_name == "Mutter" || 2250 wm_name == "Mutter" ||
2251 wm_name == "Openbox" || 2251 wm_name == "Openbox" ||
2252 wm_name == "Xfwm4"); 2252 wm_name == "Xfwm4");
2253 } 2253 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/options/preferences_window_controller.mm ('k') | chrome/browser/ui/views/chrome_views_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698