Infobar material design refresh: layout
[chromium-blink-merge.git] / chrome / browser / ui / views / extensions / browser_action_drag_data.h
blobed36426cdbbcd50e1221ba8efbb835f944ed40f4
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_
8 #include <string>
10 #include "base/basictypes.h"
12 #if defined(TOOLKIT_VIEWS)
13 #include "ui/base/dragdrop/os_exchange_data.h"
14 #endif
16 class Profile;
18 namespace base {
19 class Pickle;
22 class BrowserActionDragData {
23 public:
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();
50 #endif
52 private:
53 void WriteToPickle(Profile* profile, base::Pickle* pickle) const;
54 bool ReadFromPickle(base::Pickle* pickle);
56 // The profile we originated from.
57 void* profile_;
59 // The id of the view being dragged.
60 std::string id_;
62 // The index of the view being dragged.
63 size_t index_;
65 DISALLOW_COPY_AND_ASSIGN(BrowserActionDragData);
68 #endif // CHROME_BROWSER_UI_VIEWS_EXTENSIONS_BROWSER_ACTION_DRAG_DATA_H_