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

Side by Side Diff: chrome/browser/mac/scoped_launch_data.h

Issue 7273052: Install from disk image: Create persistent Dock icon (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 5 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
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_MAC_SCOPED_LAUNCH_DATA_H_
6 #define CHROME_BROWSER_MAC_SCOPED_LAUNCH_DATA_H_
7 #pragma once
8
9 #include <launch.h>
10
11 #include "base/basictypes.h"
12 #include "base/compiler_specific.h"
13
14 namespace launchd {
15
16 // Just like scoped_ptr<> but for launch_data_t.
17 class ScopedLaunchData {
18 public:
19 typedef launch_data_t element_type;
Robert Sesek 2011/06/29 18:26:42 What's this used for?
Mark Mentovai 2011/06/29 19:29:29 rsesek wrote:
20
21 explicit ScopedLaunchData(launch_data_t object = NULL)
22 : object_(object) {
23 }
24
25 ~ScopedLaunchData() {
26 if (object_)
27 launch_data_free(object_);
28 }
29
30 void reset(launch_data_t object = NULL) {
31 if (object != object_) {
32 if (object_)
33 launch_data_free(object_);
34 object_ = object;
35 }
36 }
37
38 bool operator==(launch_data_t that) const {
39 return object_ == that;
40 }
41
42 bool operator!=(launch_data_t that) const {
43 return object_ != that;
44 }
45
46 operator launch_data_t() const {
47 return object_;
48 }
49
50 launch_data_t get() const {
51 return object_;
52 }
53
54 void swap(ScopedLaunchData& that) {
55 launch_data_t temp = that.object_;
Robert Sesek 2011/06/29 18:26:42 std::swap()?
56 that.object_ = object_;
57 object_ = temp;
58 }
59
60 launch_data_t release() WARN_UNUSED_RESULT {
61 launch_data_t temp = object_;
62 object_ = NULL;
63 return temp;
64 }
65
66 private:
67 launch_data_t object_;
68
69 DISALLOW_COPY_AND_ASSIGN(ScopedLaunchData);
70 };
71
72 } // namespace launchd
73
74 #endif // CHROME_BROWSER_MAC_SCOPED_LAUNCH_DATA_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698