OLD | NEW |
(Empty) | |
| 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. |
| 4 |
| 5 #ifndef CHROME_BROWSER_VIEWS_EXTENSIONS_BROWSER_ACTION_DRAG_DATA_H_ |
| 6 #define CHROME_BROWSER_VIEWS_EXTENSIONS_BROWSER_ACTION_DRAG_DATA_H_ |
| 7 |
| 8 #include <string> |
| 9 |
| 10 #include "base/basictypes.h" |
| 11 |
| 12 #if defined(TOOLKIT_VIEWS) |
| 13 #include "app/os_exchange_data.h" |
| 14 #endif |
| 15 |
| 16 class BrowserActionButton; |
| 17 class FilePath; |
| 18 class Pickle; |
| 19 class Profile; |
| 20 |
| 21 class BrowserActionDragData { |
| 22 public: |
| 23 BrowserActionDragData(); |
| 24 BrowserActionDragData(const std::string& id, int index); |
| 25 |
| 26 const std::string& id() const { return id_; } |
| 27 |
| 28 size_t index() const { return index_; } |
| 29 |
| 30 // Returns true if this data is from the specified profile. |
| 31 bool IsFromProfile(Profile* profile) const; |
| 32 |
| 33 #if defined(TOOLKIT_VIEWS) |
| 34 void Write(Profile* profile, OSExchangeData* data) const; |
| 35 |
| 36 // Restores this data from the clipboard, returning true on success. |
| 37 bool Read(const OSExchangeData& data); |
| 38 |
| 39 // Returns the Custom Format this class supports (for Browser Actions). |
| 40 static OSExchangeData::CustomFormat GetBrowserActionCustomFormat(); |
| 41 #endif |
| 42 |
| 43 private: |
| 44 void WriteToPickle(Profile* profile, Pickle* pickle) const; |
| 45 bool ReadFromPickle(Pickle* pickle); |
| 46 |
| 47 // Path of the profile we originated from. |
| 48 FilePath::StringType profile_path_; |
| 49 |
| 50 // The id of the view being dragged. |
| 51 std::string id_; |
| 52 |
| 53 // The index of the view being dragged. |
| 54 size_t index_; |
| 55 |
| 56 // The MIME type for the clipboard format for BrowserActionDragData. |
| 57 static const char* kClipboardFormatString; |
| 58 |
| 59 DISALLOW_COPY_AND_ASSIGN(BrowserActionDragData); |
| 60 }; |
| 61 |
| 62 #endif // CHROME_BROWSER_VIEWS_EXTENSIONS_BROWSER_ACTION_DRAG_DATA_H_ |
OLD | NEW |