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.
5 #ifndef CHROME_BROWSER_UI_VIEWS_EXTENSIONS_BROWSER_ACTION_DRAG_DATA_H_
6 #define CHROME_BROWSER_UI_VIEWS_EXTENSIONS_BROWSER_ACTION_DRAG_DATA_H_
10 #include "base/basictypes.h"
12 #if defined(TOOLKIT_VIEWS)
13 #include "ui/base/dragdrop/os_exchange_data.h"
22 class BrowserActionDragData
{
24 BrowserActionDragData();
25 BrowserActionDragData(const std::string
& id
, int index
);
27 // These mirror the views::View and views::MenuDelegate methods for dropping,
28 // and return the appropriate results for being able to drop an extension's
29 // BrowserAction view.
30 static bool GetDropFormats(
31 std::set
<ui::OSExchangeData::CustomFormat
>* custom_formats
);
32 static bool AreDropTypesRequired();
33 static bool CanDrop(const ui::OSExchangeData
& data
, const Profile
* profile
);
35 const std::string
& id() const { return id_
; }
37 size_t index() const { return index_
; }
39 // Returns true if this data is from the specified profile.
40 bool IsFromProfile(const Profile
* profile
) const;
42 #if defined(TOOLKIT_VIEWS)
43 void Write(Profile
* profile
, ui::OSExchangeData
* data
) const;
45 // Restores this data from the clipboard, returning true on success.
46 bool Read(const ui::OSExchangeData
& data
);
48 // Returns the Custom Format this class supports (for Browser Actions).
49 static const ui::OSExchangeData::CustomFormat
& GetBrowserActionCustomFormat();
53 void WriteToPickle(Profile
* profile
, base::Pickle
* pickle
) const;
54 bool ReadFromPickle(base::Pickle
* pickle
);
56 // The profile we originated from.
59 // The id of the view being dragged.
62 // The index of the view being dragged.
65 DISALLOW_COPY_AND_ASSIGN(BrowserActionDragData
);
68 #endif // CHROME_BROWSER_UI_VIEWS_EXTENSIONS_BROWSER_ACTION_DRAG_DATA_H_