blob: b15e07cbf924da6b606b2246497c65b94a6a7679 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
|
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_BOOKMARK_MANAGER_API_H_
#define CHROME_BROWSER_EXTENSIONS_EXTENSION_BOOKMARK_MANAGER_API_H_
#include "chrome/browser/bookmarks/bookmark_drag_data.h"
#include "chrome/browser/extensions/extension_bookmarks_module.h"
#include "chrome/browser/extensions/extension_function.h"
#include "chrome/browser/renderer_host/render_view_host_delegate.h"
#include "chrome/browser/shell_dialogs.h"
struct BookmarkDragData;
class BookmarkNode;
class ListValue;
class Profile;
class TabContents;
// Class that handles the chrome.experimental.bookmarkManager events.
class ExtensionBookmarkManagerEventRouter
: public RenderViewHostDelegate::BookmarkDrag {
public:
ExtensionBookmarkManagerEventRouter(Profile* profile,
TabContents* tab_contents);
virtual ~ExtensionBookmarkManagerEventRouter();
// RenderViewHostDelegate::BookmarkDrag interface
virtual void OnDragEnter(const BookmarkDragData& data);
virtual void OnDragOver(const BookmarkDragData& data);
virtual void OnDragLeave(const BookmarkDragData& data);
virtual void OnDrop(const BookmarkDragData& data);
// The bookmark drag and drop data. This gets set after a drop was done on
// the page. This returns NULL if no data is available.
const BookmarkDragData* GetBookmarkDragData();
// Clears the drag and drop data.
void ClearBookmarkDragData();
private:
// Helper to actually dispatch an event to extension listeners.
void DispatchEvent(const char* event_name, const ListValue* args);
void DispatchDragEvent(const BookmarkDragData& data, const char* event_name);
Profile* profile_;
TabContents* tab_contents_;
BookmarkDragData bookmark_drag_data_;
DISALLOW_COPY_AND_ASSIGN(ExtensionBookmarkManagerEventRouter);
};
class ClipboardBookmarkManagerFunction : public BookmarksFunction {
protected:
bool CopyOrCut(bool cut);
};
class CopyBookmarkManagerFunction : public ClipboardBookmarkManagerFunction {
public:
// Override ClipboardBookmarkManagerFunction.
virtual bool RunImpl();
private:
DECLARE_EXTENSION_FUNCTION_NAME("experimental.bookmarkManager.copy");
};
class CutBookmarkManagerFunction : public ClipboardBookmarkManagerFunction {
public:
// Override ClipboardBookmarkManagerFunction.
virtual bool RunImpl();
private:
DECLARE_EXTENSION_FUNCTION_NAME("experimental.bookmarkManager.cut");
};
class PasteBookmarkManagerFunction : public BookmarksFunction {
public:
// Override BookmarksFunction.
virtual bool RunImpl();
private:
DECLARE_EXTENSION_FUNCTION_NAME("experimental.bookmarkManager.paste");
};
class CanPasteBookmarkManagerFunction
: public BookmarksFunction {
public:
// Override BookmarksFunction.
virtual bool RunImpl();
private:
DECLARE_EXTENSION_FUNCTION_NAME("experimental.bookmarkManager.canPaste");
};
class BookmarkManagerIOFunction : public BookmarksFunction,
public SelectFileDialog::Listener {
public:
// Overridden from SelectFileDialog::Listener:
virtual void FileSelected(const FilePath& path, int index, void* params) = 0;
void MultiFilesSelected(const std::vector<FilePath>& files, void* params);
void FileSelectionCanceled(void* params);
void SelectFile(SelectFileDialog::Type type);
protected:
scoped_refptr<SelectFileDialog> select_file_dialog_;
};
class ImportBookmarksFunction : public BookmarkManagerIOFunction {
public:
// Override BookmarkManagerIOFunction.
bool RunImpl();
void FileSelected(const FilePath& path, int index, void* params);
private:
DECLARE_EXTENSION_FUNCTION_NAME("experimental.bookmarkManager.import");
};
class ExportBookmarksFunction : public BookmarkManagerIOFunction {
public:
// Override BookmarkManagerIOFunction.
bool RunImpl();
void FileSelected(const FilePath& path, int index, void* params);
private:
DECLARE_EXTENSION_FUNCTION_NAME("experimental.bookmarkManager.export");
};
class SortChildrenBookmarkManagerFunction
: public BookmarksFunction {
public:
// Override BookmarksFunction.
virtual bool RunImpl();
private:
DECLARE_EXTENSION_FUNCTION_NAME(
"experimental.bookmarkManager.sortChildren");
};
class BookmarkManagerGetStringsFunction : public AsyncExtensionFunction {
public:
// Override AsyncExtensionFunction.
virtual bool RunImpl();
private:
DECLARE_EXTENSION_FUNCTION_NAME("experimental.bookmarkManager.getStrings");
};
class StartDragBookmarkManagerFunction
: public BookmarksFunction {
public:
// Override BookmarksFunction.
virtual bool RunImpl();
private:
DECLARE_EXTENSION_FUNCTION_NAME("experimental.bookmarkManager.startDrag");
};
class DropBookmarkManagerFunction : public BookmarksFunction {
public:
virtual bool RunImpl();
private:
DECLARE_EXTENSION_FUNCTION_NAME("experimental.bookmarkManager.drop");
};
#endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_BOOKMARK_MANAGER_API_H_
|