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