[Metrics] Make MetricsStateManager take a callback param to check if UMA is enabled.
[chromium-blink-merge.git] / chrome / browser / ui / cocoa / window_size_autosaver.h
blobe167125afa6343153cf313af2c5a75bdcd2f6661
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_UI_COCOA_WINDOW_SIZE_AUTOSAVER_H_
6 #define CHROME_BROWSER_UI_COCOA_WINDOW_SIZE_AUTOSAVER_H_
8 class PrefService;
9 @class NSWindow;
11 // WindowSizeAutosaver is a helper class that makes it easy to let windows
12 // autoremember their position or position and size in a PrefService object.
13 // To use this, add a |base::scoped_nsobject<WindowSizeAutosaver>| to your
14 // window
15 // controller and initialize it in the window controller's init method, passing
16 // a window and an autosave name. The autosaver will register for "window moved"
17 // and "window resized" notifications and write the current window state to the
18 // prefs service every time they fire. The window's size is automatically
19 // restored when the autosaver's |initWithWindow:...| method is called.
21 // Note: Your xib file should have "Visible at launch" UNCHECKED, so that the
22 // initial repositioning is not visible.
23 @interface WindowSizeAutosaver : NSObject {
24 NSWindow* window_; // weak
25 PrefService* prefService_; // weak
26 const char* path_;
29 - (id)initWithWindow:(NSWindow*)window
30 prefService:(PrefService*)prefs
31 path:(const char*)path;
32 @end
34 #endif // CHROME_BROWSER_UI_COCOA_WINDOW_SIZE_AUTOSAVER_H_