diff options
author | mirandac@chromium.org <mirandac@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-02 18:46:16 +0000 |
---|---|---|
committer | mirandac@chromium.org <mirandac@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-02 18:46:16 +0000 |
commit | f87919d70dd8ec6cacf8de22ad670466fc035574 (patch) | |
tree | e9697299edad96c759ff87332dabb47c6defbfaa /chrome/browser/ui | |
parent | 2cbcdca119f009bdf15608eebd9d3322d08e0861 (diff) | |
download | chromium_src-f87919d70dd8ec6cacf8de22ad670466fc035574.zip chromium_src-f87919d70dd8ec6cacf8de22ad670466fc035574.tar.gz chromium_src-f87919d70dd8ec6cacf8de22ad670466fc035574.tar.bz2 |
Remove user-related data from local_state and add to user_preferences, in preparation for multi-profile.
devtools
kDevToolsSplitLocation
browser
kBrowserWindowPlacement
Also add a method to browser_prefs to delete obsolete preferences from local state, and fix all related tests.
BUG=66717
TEST=all browser, interactive, and ui tests work properly
Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=72153
Review URL: http://codereview.chromium.org/5915006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@73481 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/ui')
-rw-r--r-- | chrome/browser/ui/browser.cc | 21 | ||||
-rw-r--r-- | chrome/browser/ui/browser.h | 7 | ||||
-rw-r--r-- | chrome/browser/ui/cocoa/browser_window_controller.mm | 6 | ||||
-rw-r--r-- | chrome/browser/ui/cocoa/browser_window_controller_private.mm | 7 | ||||
-rw-r--r-- | chrome/browser/ui/cocoa/browser_window_controller_unittest.mm | 4 | ||||
-rw-r--r-- | chrome/browser/ui/cocoa/dev_tools_controller.h | 6 | ||||
-rw-r--r-- | chrome/browser/ui/cocoa/dev_tools_controller.mm | 19 | ||||
-rw-r--r-- | chrome/browser/ui/cocoa/options/preferences_window_controller.mm | 2 | ||||
-rw-r--r-- | chrome/browser/ui/gtk/browser_window_gtk.cc | 14 | ||||
-rw-r--r-- | chrome/browser/ui/views/chrome_views_delegate.cc | 43 | ||||
-rw-r--r-- | chrome/browser/ui/views/frame/browser_view.cc | 8 | ||||
-rw-r--r-- | chrome/browser/ui/window_sizer.cc | 19 | ||||
-rw-r--r-- | chrome/browser/ui/window_sizer.h | 5 |
13 files changed, 97 insertions, 64 deletions
diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc index 7893aee..3cc2206 100644 --- a/chrome/browser/ui/browser.cc +++ b/chrome/browser/ui/browser.cc @@ -557,7 +557,7 @@ TabContents* Browser::OpenApplicationWindow( else app_name = web_app::GenerateApplicationNameFromURL(url); - RegisterAppPrefs(app_name); + RegisterAppPrefs(app_name, profile); bool as_panel = extension && (container == extension_misc::LAUNCH_PANEL); @@ -775,7 +775,7 @@ gfx::Rect Browser::GetSavedWindowBounds() const { gfx::Rect restored_bounds = override_bounds_; bool maximized; - WindowSizer::GetBrowserWindowBounds(app_name_, restored_bounds, NULL, + WindowSizer::GetBrowserWindowBounds(app_name_, restored_bounds, this, &restored_bounds, &maximized); return restored_bounds; } @@ -794,7 +794,7 @@ bool Browser::GetSavedMaximizedState() const { // An explicit maximized state was not set. Query the window sizer. gfx::Rect restored_bounds; bool maximized = false; - WindowSizer::GetBrowserWindowBounds(app_name_, restored_bounds, NULL, + WindowSizer::GetBrowserWindowBounds(app_name_, restored_bounds, this, &restored_bounds, &maximized); return maximized; } @@ -2015,11 +2015,10 @@ void Browser::SetNewHomePagePrefs(PrefService* prefs) { // static void Browser::RegisterPrefs(PrefService* prefs) { - prefs->RegisterDictionaryPref(prefs::kBrowserWindowPlacement); prefs->RegisterIntegerPref(prefs::kOptionsWindowLastTabIndex, 0); - prefs->RegisterIntegerPref(prefs::kDevToolsSplitLocation, -1); prefs->RegisterDictionaryPref(prefs::kPreferencesWindowPlacement); prefs->RegisterIntegerPref(prefs::kExtensionSidebarWidth, -1); + prefs->RegisterIntegerPref(prefs::kMultipleProfilePrefMigration, 0); // Educated guess: Chrome has a bundled Flash version supporting // clearing LSO data, Chromium hasn't. #if defined(GOOGLE_CHROME_BUILD) @@ -2068,7 +2067,8 @@ void Browser::RegisterUserPrefs(PrefService* prefs) { prefs->RegisterBooleanPref(prefs::kDevToolsDisabled, false); prefs->RegisterBooleanPref(prefs::kIncognitoEnabled, true); prefs->RegisterDoublePref(prefs::kDefaultZoomLevel, 0.0); - prefs->RegisterIntegerPref(prefs::kMultipleProfilePrefMigration, 0); + prefs->RegisterIntegerPref(prefs::kDevToolsSplitLocation, -1); + prefs->RegisterDictionaryPref(prefs::kBrowserWindowPlacement); // We need to register the type of this preference in order to query // it even though it's only typically controlled via policy. prefs->RegisterBooleanPref(prefs::kDisable3DAPIs, false); @@ -3011,7 +3011,7 @@ bool Browser::IsApplication() const { void Browser::ConvertContentsToApplication(TabContents* contents) { const GURL& url = contents->controller().GetActiveEntry()->url(); std::string app_name = web_app::GenerateApplicationNameFromURL(url); - RegisterAppPrefs(app_name); + RegisterAppPrefs(app_name, contents->profile()); DetachContents(contents); Browser* app_browser = Browser::CreateForApp( @@ -4167,7 +4167,7 @@ void Browser::TabDetachedAtImpl(TabContentsWrapper* contents, int index, } // static -void Browser::RegisterAppPrefs(const std::string& app_name) { +void Browser::RegisterAppPrefs(const std::string& app_name, Profile* profile) { // A set of apps that we've already started. static std::set<std::string>* g_app_names = NULL; @@ -4183,10 +4183,7 @@ void Browser::RegisterAppPrefs(const std::string& app_name) { std::string window_pref(prefs::kBrowserWindowPlacement); window_pref.append("_"); window_pref.append(app_name); - PrefService* prefs = g_browser_process->local_state(); - DCHECK(prefs); - - prefs->RegisterDictionaryPref(window_pref.c_str()); + profile->GetPrefs()->RegisterDictionaryPref(window_pref.c_str()); } void Browser::TabRestoreServiceChanged(TabRestoreService* service) { diff --git a/chrome/browser/ui/browser.h b/chrome/browser/ui/browser.h index 0ab7df6..eaa2b57 100644 --- a/chrome/browser/ui/browser.h +++ b/chrome/browser/ui/browser.h @@ -961,9 +961,10 @@ class Browser : public TabHandlerDelegate, void TabDetachedAtImpl(TabContentsWrapper* contents, int index, DetachType type); - // Create a preference dictionary for the provided application name. This is - // done only once per application name / per session. - static void RegisterAppPrefs(const std::string& app_name); + // Create a preference dictionary for the provided application name, in the + // given user profile. This is done only once per application name / per + // session / per user profile. + static void RegisterAppPrefs(const std::string& app_name, Profile* profile); // Shared code between Reload() and ReloadIgnoringCache(). void ReloadInternal(WindowOpenDisposition disposition, bool ignore_cache); diff --git a/chrome/browser/ui/cocoa/browser_window_controller.mm b/chrome/browser/ui/cocoa/browser_window_controller.mm index 38c0974..5407f74 100644 --- a/chrome/browser/ui/cocoa/browser_window_controller.mm +++ b/chrome/browser/ui/cocoa/browser_window_controller.mm @@ -479,7 +479,8 @@ } - (void)updateDevToolsForContents:(TabContents*)contents { - [devToolsController_ updateDevToolsForTabContents:contents]; + [devToolsController_ updateDevToolsForTabContents:contents + withProfile:browser_->profile()]; [devToolsController_ ensureContentsVisible]; } @@ -1428,7 +1429,8 @@ windowShim_->UpdateTitleBar(); [sidebarController_ updateSidebarForTabContents:contents]; - [devToolsController_ updateDevToolsForTabContents:contents]; + [devToolsController_ updateDevToolsForTabContents:contents + withProfile:browser_->profile()]; // Update the bookmark bar. // Must do it after sidebar and devtools update, otherwise bookmark bar might diff --git a/chrome/browser/ui/cocoa/browser_window_controller_private.mm b/chrome/browser/ui/cocoa/browser_window_controller_private.mm index 813d51e..37cd9c0 100644 --- a/chrome/browser/ui/cocoa/browser_window_controller_private.mm +++ b/chrome/browser/ui/cocoa/browser_window_controller_private.mm @@ -62,11 +62,12 @@ const CGFloat kLocBarBottomInset = 1; if (browser_ != BrowserList::GetLastActive()) return; - if (!g_browser_process || !g_browser_process->local_state() || - !browser_->ShouldSaveWindowPlacement()) + if (!browser_->profile()->GetPrefs() || + !browser_->ShouldSaveWindowPlacement()) { return; + } - [self saveWindowPositionToPrefs:g_browser_process->local_state()]; + [self saveWindowPositionToPrefs:browser_->profile()->GetPrefs()]; } - (void)saveWindowPositionToPrefs:(PrefService*)prefs { diff --git a/chrome/browser/ui/cocoa/browser_window_controller_unittest.mm b/chrome/browser/ui/cocoa/browser_window_controller_unittest.mm index 497967b..8ca0617 100644 --- a/chrome/browser/ui/cocoa/browser_window_controller_unittest.mm +++ b/chrome/browser/ui/cocoa/browser_window_controller_unittest.mm @@ -91,9 +91,7 @@ TEST_F(BrowserWindowControllerTest, TestSaveWindowPosition) { EXPECT_TRUE(browser_window_placement->empty()); // Ask the window to save its position, then check that a preference - // exists. We're technically passing in a pointer to the user prefs - // and not the local state prefs, but a PrefService* is a - // PrefService*, and this is a unittest. + // exists. [controller_ saveWindowPositionToPrefs:prefs]; browser_window_placement = prefs->GetDictionary(prefs::kBrowserWindowPlacement); diff --git a/chrome/browser/ui/cocoa/dev_tools_controller.h b/chrome/browser/ui/cocoa/dev_tools_controller.h index a976884..e8fa567 100644 --- a/chrome/browser/ui/cocoa/dev_tools_controller.h +++ b/chrome/browser/ui/cocoa/dev_tools_controller.h @@ -14,11 +14,12 @@ @class NSSplitView; @class NSView; +class Profile; class TabContents; // A class that handles updates of the devTools view within a browser window. // It swaps in the relevant devTools contents for a given TabContents or removes -// the vew, if there's no devTools contents to show. +// the view, if there's no devTools contents to show. @interface DevToolsController : NSObject { @private // A view hosting docked devTools contents. @@ -40,7 +41,8 @@ class TabContents; // Depending on |contents|'s state, decides whether the docked web inspector // should be shown or hidden and adjusts its height (|delegate_| handles // the actual resize). -- (void)updateDevToolsForTabContents:(TabContents*)contents; +- (void)updateDevToolsForTabContents:(TabContents*)contents + withProfile:(Profile*)profile; // Call when the devTools view is properly sized and the render widget host view // should be put into the view hierarchy. diff --git a/chrome/browser/ui/cocoa/dev_tools_controller.mm b/chrome/browser/ui/cocoa/dev_tools_controller.mm index 4d29794..617d773 100644 --- a/chrome/browser/ui/cocoa/dev_tools_controller.mm +++ b/chrome/browser/ui/cocoa/dev_tools_controller.mm @@ -11,6 +11,7 @@ #include "chrome/browser/browser_process.h" #include "chrome/browser/debugger/devtools_window.h" #include "chrome/browser/prefs/pref_service.h" +#include "chrome/browser/profiles/profile.h" #include "chrome/browser/tab_contents/tab_contents.h" #import "chrome/browser/ui/cocoa/view_id_util.h" #include "chrome/common/pref_names.h" @@ -28,7 +29,8 @@ const int kMinWebHeight = 50; @interface DevToolsController (Private) -- (void)showDevToolsContents:(TabContents*)devToolsContents; +- (void)showDevToolsContents:(TabContents*)devToolsContents + withProfile:(Profile*)profile; - (void)resizeDevToolsToNewHeight:(CGFloat)height; @end @@ -63,19 +65,21 @@ const int kMinWebHeight = 50; return splitView_.get(); } -- (void)updateDevToolsForTabContents:(TabContents*)contents { +- (void)updateDevToolsForTabContents:(TabContents*)contents + withProfile:(Profile*)profile { // Get current devtools content. TabContents* devToolsContents = contents ? DevToolsWindow::GetDevToolsContents(contents) : NULL; - [self showDevToolsContents:devToolsContents]; + [self showDevToolsContents:devToolsContents withProfile:profile]; } - (void)ensureContentsVisible { [contentsController_ ensureContentsVisible]; } -- (void)showDevToolsContents:(TabContents*)devToolsContents { +- (void)showDevToolsContents:(TabContents*)devToolsContents + withProfile:(Profile*)profile { [contentsController_ ensureContentsSizeDoesNotChange]; NSArray* subviews = [splitView_ subviews]; @@ -91,8 +95,8 @@ const int kMinWebHeight = 50; CGFloat splitOffset = 0; if ([subviews count] == 1) { // Load the default split offset. - splitOffset = g_browser_process->local_state()->GetInteger( - prefs::kDevToolsSplitLocation); + splitOffset = profile->GetPrefs()-> + GetInteger(prefs::kDevToolsSplitLocation); if (splitOffset < 0) { // Initial load, set to default value. splitOffset = kDefaultContentsSplitOffset; @@ -117,7 +121,8 @@ const int kMinWebHeight = 50; NSView* oldDevToolsContentsView = [subviews objectAtIndex:1]; // Store split offset when hiding devtools window only. int splitOffset = NSHeight([oldDevToolsContentsView frame]); - g_browser_process->local_state()->SetInteger( + + profile->GetPrefs()->SetInteger( prefs::kDevToolsSplitLocation, splitOffset); [oldDevToolsContentsView removeFromSuperview]; [splitView_ adjustSubviews]; diff --git a/chrome/browser/ui/cocoa/options/preferences_window_controller.mm b/chrome/browser/ui/cocoa/options/preferences_window_controller.mm index e5332b6..1de5ada 100644 --- a/chrome/browser/ui/cocoa/options/preferences_window_controller.mm +++ b/chrome/browser/ui/cocoa/options/preferences_window_controller.mm @@ -776,7 +776,7 @@ class ManagedPrefsBannerState : public policy::ManagedPrefsBannerBase { if (g_browser_process && g_browser_process->local_state()) { sizeSaver_.reset([[WindowSizeAutosaver alloc] initWithWindow:[self window] - prefService:g_browser_process->local_state() + prefService:profile_->GetPrefs() path:prefs::kPreferencesWindowPlacement]); } diff --git a/chrome/browser/ui/gtk/browser_window_gtk.cc b/chrome/browser/ui/gtk/browser_window_gtk.cc index af4d519..1a49281 100644 --- a/chrome/browser/ui/gtk/browser_window_gtk.cc +++ b/chrome/browser/ui/gtk/browser_window_gtk.cc @@ -1274,8 +1274,8 @@ void BrowserWindowGtk::UpdateDevToolsForContents(TabContents* contents) { } else if (should_hide) { // Store split offset when hiding devtools window only. gint divider_offset = gtk_paned_get_position(GTK_PANED(contents_split_)); - g_browser_process->local_state()->SetInteger( - prefs::kDevToolsSplitLocation, divider_offset); + browser_->profile()->GetPrefs()-> + SetInteger(prefs::kDevToolsSplitLocation, divider_offset); gtk_widget_hide(devtools_container_->widget()); } } @@ -1598,8 +1598,8 @@ void BrowserWindowGtk::InitWidgets() { FALSE, TRUE); gtk_box_pack_end(GTK_BOX(render_area_vbox_), contents_split_, TRUE, TRUE, 0); // Restore split offset. - int split_offset = g_browser_process->local_state()->GetInteger( - prefs::kDevToolsSplitLocation); + int split_offset = browser_->profile()->GetPrefs()-> + GetInteger(prefs::kDevToolsSplitLocation); if (split_offset != -1) { if (split_offset < kMinDevToolsHeight) split_offset = kMinDevToolsHeight; @@ -1759,13 +1759,13 @@ void BrowserWindowGtk::SaveWindowPosition() { // We also need to save the placement for startup. // This is a web of calls between views and delegates on Windows, but the // crux of the logic follows. See also cocoa/browser_window_controller.mm. - if (!g_browser_process->local_state()) + if (!browser_->profile()->GetPrefs()) return; std::string window_name = browser_->GetWindowPlacementKey(); DictionaryValue* window_preferences = - g_browser_process->local_state()->GetMutableDictionary( - window_name.c_str()); + browser_->profile()->GetPrefs()-> + GetMutableDictionary(window_name.c_str()); // Note that we store left/top for consistency with Windows, but that we // *don't* obey them; we only use them for computing width/height. See // comments in SetGeometryHints(). diff --git a/chrome/browser/ui/views/chrome_views_delegate.cc b/chrome/browser/ui/views/chrome_views_delegate.cc index 86faf4c..2d0a95e 100644 --- a/chrome/browser/ui/views/chrome_views_delegate.cc +++ b/chrome/browser/ui/views/chrome_views_delegate.cc @@ -5,11 +5,14 @@ #include "chrome/browser/ui/views/chrome_views_delegate.h" #include "base/scoped_ptr.h" +#include "base/string_util.h" #include "base/utf_string_conversions.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/prefs/pref_service.h" +#include "chrome/browser/profiles/profile_manager.h" #include "chrome/browser/ui/views/accessibility_event_router_views.h" #include "chrome/browser/ui/window_sizer.h" +#include "chrome/common/pref_names.h" #include "gfx/rect.h" #include "ui/base/clipboard/clipboard.h" @@ -17,6 +20,27 @@ #include "chrome/browser/app_icon_win.h" #endif +namespace { + +// Some window data should be stored in local state, instead of by profile; use +// the window_name to differentiate between storage types. This function may +// return NULL if the necessary PrefService has not yet been initialized. +// TODO(mirandac): This function will also serve to separate windows by profile +// in a multiprofile environment. +PrefService* GetPrefsForWindow(const std::wstring& window_name) { + if (LowerCaseEqualsASCII(window_name, prefs::kTaskManagerWindowPlacement)) { + return g_browser_process->local_state(); + } else { + if (!g_browser_process->profile_manager()) { + return NULL; + } + return g_browser_process->profile_manager()->GetDefaultProfile()-> + GetPrefs(); + } +} + +} // namespace + /////////////////////////////////////////////////////////////////////////////// // ChromeViewsDelegate, views::ViewsDelegate implementation: @@ -27,12 +51,12 @@ ui::Clipboard* ChromeViewsDelegate::GetClipboard() const { void ChromeViewsDelegate::SaveWindowPlacement(const std::wstring& window_name, const gfx::Rect& bounds, bool maximized) { - if (!g_browser_process->local_state()) + PrefService* prefs = GetPrefsForWindow(window_name); + if (!prefs) return; DictionaryValue* window_preferences = - g_browser_process->local_state()->GetMutableDictionary( - WideToUTF8(window_name).c_str()); + prefs->GetMutableDictionary(WideToUTF8(window_name).c_str()); window_preferences->SetInteger("left", bounds.x()); window_preferences->SetInteger("top", bounds.y()); window_preferences->SetInteger("right", bounds.right()); @@ -51,12 +75,12 @@ void ChromeViewsDelegate::SaveWindowPlacement(const std::wstring& window_name, bool ChromeViewsDelegate::GetSavedWindowBounds(const std::wstring& window_name, gfx::Rect* bounds) const { - if (!g_browser_process->local_state()) + PrefService* prefs = GetPrefsForWindow(window_name); + if (!prefs) return false; const DictionaryValue* dictionary = - g_browser_process->local_state()->GetDictionary( - WideToUTF8(window_name).c_str()); + prefs->GetDictionary(WideToUTF8(window_name).c_str()); int left, top, right, bottom; if (!dictionary || !dictionary->GetInteger("left", &left) || !dictionary->GetInteger("top", &top) || @@ -71,12 +95,13 @@ bool ChromeViewsDelegate::GetSavedWindowBounds(const std::wstring& window_name, bool ChromeViewsDelegate::GetSavedMaximizedState( const std::wstring& window_name, bool* maximized) const { - if (!g_browser_process->local_state()) + PrefService* prefs = GetPrefsForWindow(window_name); + if (!prefs) return false; const DictionaryValue* dictionary = - g_browser_process->local_state()->GetDictionary( - WideToUTF8(window_name).c_str()); + prefs->GetDictionary(WideToUTF8(window_name).c_str()); + return dictionary && dictionary->GetBoolean("maximized", maximized) && maximized; } diff --git a/chrome/browser/ui/views/frame/browser_view.cc b/chrome/browser/ui/views/frame/browser_view.cc index d55f390..e6a5f8a 100644 --- a/chrome/browser/ui/views/frame/browser_view.cc +++ b/chrome/browser/ui/views/frame/browser_view.cc @@ -2114,8 +2114,8 @@ void BrowserView::UpdateDevToolsForContents(TabContentsWrapper* wrapper) { } // Restore split offset. - int split_offset = g_browser_process->local_state()->GetInteger( - prefs::kDevToolsSplitLocation); + int split_offset = browser_->profile()->GetPrefs()-> + GetInteger(prefs::kDevToolsSplitLocation); if (split_offset == -1) { // Initial load, set to default value. split_offset = 2 * contents_split_->height() / 3; @@ -2131,8 +2131,8 @@ void BrowserView::UpdateDevToolsForContents(TabContentsWrapper* wrapper) { Layout(); } else if (should_hide) { // Store split offset when hiding devtools window only. - g_browser_process->local_state()->SetInteger( - prefs::kDevToolsSplitLocation, contents_split_->divider_offset()); + browser_->profile()->GetPrefs()->SetInteger(prefs::kDevToolsSplitLocation, + contents_split_->divider_offset()); // Restore focus to the last focused view when hiding devtools window. devtools_focus_tracker_->FocusLastFocusedExternalView(); diff --git a/chrome/browser/ui/window_sizer.cc b/chrome/browser/ui/window_sizer.cc index 292f5fc..e1dd834 100644 --- a/chrome/browser/ui/window_sizer.cc +++ b/chrome/browser/ui/window_sizer.cc @@ -6,6 +6,7 @@ #include "chrome/browser/browser_process.h" #include "chrome/browser/prefs/pref_service.h" +#include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_list.h" #include "chrome/browser/ui/browser_window.h" @@ -16,9 +17,9 @@ // and persistent state from the browser window and the user's profile. class DefaultStateProvider : public WindowSizer::StateProvider { public: - explicit DefaultStateProvider(const std::string& app_name, Browser* browser) - : app_name_(app_name), - browser_(browser) { + explicit DefaultStateProvider(const std::string& app_name, + const Browser* browser) : app_name_(app_name), + browser_(browser) { } // Overridden from WindowSizer::StateProvider: @@ -33,11 +34,11 @@ class DefaultStateProvider : public WindowSizer::StateProvider { key.append(app_name_); } - if (!g_browser_process->local_state()) + if (!browser_->profile()->GetPrefs()) return false; const DictionaryValue* wp_pref = - g_browser_process->local_state()->GetDictionary(key.c_str()); + browser_->profile()->GetPrefs()->GetDictionary(key.c_str()); int top = 0, left = 0, bottom = 0, right = 0; bool has_prefs = wp_pref && @@ -74,9 +75,9 @@ class DefaultStateProvider : public WindowSizer::StateProvider { // If a reference browser is set, use its window. Otherwise find last // active. BrowserWindow* window = NULL; - if (browser_) { + // Window may be null if browser is just starting up. + if (browser_ && browser_->window()) { window = browser_->window(); - DCHECK(window); } else { BrowserList::const_reverse_iterator it = BrowserList::begin_last_active(); BrowserList::const_reverse_iterator end = BrowserList::end_last_active(); @@ -102,7 +103,7 @@ class DefaultStateProvider : public WindowSizer::StateProvider { std::string app_name_; // If set, is used as the reference browser for GetLastActiveWindowState. - Browser* browser_; + const Browser* browser_; DISALLOW_COPY_AND_ASSIGN(DefaultStateProvider); }; @@ -132,7 +133,7 @@ WindowSizer::~WindowSizer() { // static void WindowSizer::GetBrowserWindowBounds(const std::string& app_name, const gfx::Rect& specified_bounds, - Browser* browser, + const Browser* browser, gfx::Rect* window_bounds, bool* maximized) { const WindowSizer sizer(new DefaultStateProvider(app_name, browser), diff --git a/chrome/browser/ui/window_sizer.h b/chrome/browser/ui/window_sizer.h index 7d34399..a943f43 100644 --- a/chrome/browser/ui/window_sizer.h +++ b/chrome/browser/ui/window_sizer.h @@ -121,7 +121,7 @@ class WindowSizer { // non-NULL value for |browser|. static void GetBrowserWindowBounds(const std::string& app_name, const gfx::Rect& specified_bounds, - Browser* browser, + const Browser* browser, gfx::Rect* window_bounds, bool* maximized); @@ -181,4 +181,5 @@ class WindowSizer { DISALLOW_COPY_AND_ASSIGN(WindowSizer); }; -#endif // CHROME_BROWSER_WINDOW_SIZER_H_ +#endif // CHROME_BROWSER_UI_WINDOW_SIZER_H_ + |