OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 // C++ bridge class to send a selector to a Cocoa object when the | 5 // C++ bridge class to send a selector to a Cocoa object when the |
6 // bookmark model changes. Some Cocoa objects edit the bookmark model | 6 // bookmark model changes. Some Cocoa objects edit the bookmark model |
7 // and temporarily save a copy of the state (e.g. bookmark button | 7 // and temporarily save a copy of the state (e.g. bookmark button |
8 // editor). As a fail-safe, these objects want an easy cancel if the | 8 // editor). As a fail-safe, these objects want an easy cancel if the |
9 // model changes out from under them. For example, if you have the | 9 // model changes out from under them. For example, if you have the |
10 // bookmark button editor sheet open, then edit the bookmark in the | 10 // bookmark button editor sheet open, then edit the bookmark in the |
11 // bookmark manager, we'd want to simply cancel the editor. | 11 // bookmark manager, we'd want to simply cancel the editor. |
12 // | 12 // |
13 // This class is conservative and may result in notifications which | 13 // This class is conservative and may result in notifications which |
14 // aren't strictly necessary. For example, node removal only needs to | 14 // aren't strictly necessary. For example, node removal only needs to |
15 // cancel an edit if the removed node is a folder (editors often have | 15 // cancel an edit if the removed node is a folder (editors often have |
16 // a list of "new parents"). But, just to be sure, notification | 16 // a list of "new parents"). But, just to be sure, notification |
17 // happens on any removal. | 17 // happens on any removal. |
18 | 18 |
19 #ifndef CHROME_BROWSER_UI_COCOA_BOOKMARKS_BOOKMARK_MODEL_OBSERVER_FOR_COCOA_H | 19 #ifndef CHROME_BROWSER_UI_COCOA_BOOKMARKS_BOOKMARK_MODEL_OBSERVER_FOR_COCOA_H_ |
20 #define CHROME_BROWSER_UI_COCOA_BOOKMARKS_BOOKMARK_MODEL_OBSERVER_FOR_COCOA_H | 20 #define CHROME_BROWSER_UI_COCOA_BOOKMARKS_BOOKMARK_MODEL_OBSERVER_FOR_COCOA_H_ |
21 | 21 |
22 #import <Cocoa/Cocoa.h> | 22 #import <Cocoa/Cocoa.h> |
23 | 23 |
24 #include <set> | 24 #include <set> |
25 | 25 |
26 #include "base/mac/scoped_block.h" | 26 #include "base/mac/scoped_block.h" |
27 #include "base/macros.h" | 27 #include "base/macros.h" |
28 #include "components/bookmarks/browser/bookmark_model.h" | 28 #include "components/bookmarks/browser/bookmark_model.h" |
29 #include "components/bookmarks/browser/bookmark_model_observer.h" | 29 #include "components/bookmarks/browser/bookmark_model_observer.h" |
30 | 30 |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 std::set<const bookmarks::BookmarkNode*> | 87 std::set<const bookmarks::BookmarkNode*> |
88 nodes_; // Weak items owned by a BookmarkModel. | 88 nodes_; // Weak items owned by a BookmarkModel. |
89 base::mac::ScopedBlock<ChangeCallback> callback_; | 89 base::mac::ScopedBlock<ChangeCallback> callback_; |
90 | 90 |
91 // Send a notification to the client. | 91 // Send a notification to the client. |
92 void Notify(); | 92 void Notify(); |
93 | 93 |
94 DISALLOW_COPY_AND_ASSIGN(BookmarkModelObserverForCocoa); | 94 DISALLOW_COPY_AND_ASSIGN(BookmarkModelObserverForCocoa); |
95 }; | 95 }; |
96 | 96 |
97 #endif // CHROME_BROWSER_UI_COCOA_BOOKMARKS_BOOKMARK_MODEL_OBSERVER_FOR_COCOA_H | 97 #endif // CHROME_BROWSER_UI_COCOA_BOOKMARKS_BOOKMARK_MODEL_OBSERVER_FOR_COCOA_H
_ |
OLD | NEW |