summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/views/extensions/browser_action_drag_data.cc25
-rw-r--r--chrome/browser/views/extensions/browser_action_drag_data.h5
-rw-r--r--chrome/browser/views/extensions/browser_action_drag_data_unittest.cc3
3 files changed, 16 insertions, 17 deletions
diff --git a/chrome/browser/views/extensions/browser_action_drag_data.cc b/chrome/browser/views/extensions/browser_action_drag_data.cc
index 103738f..2d772ea 100644
--- a/chrome/browser/views/extensions/browser_action_drag_data.cc
+++ b/chrome/browser/views/extensions/browser_action_drag_data.cc
@@ -14,19 +14,16 @@ const char* BrowserActionDragData::kClipboardFormatString =
"chromium/x-browser-actions";
BrowserActionDragData::BrowserActionDragData()
- : index_(-1) {
+ : profile_id_(0), index_(-1) {
}
BrowserActionDragData::BrowserActionDragData(
const std::string& id, int index)
- : id_(id),
- index_(index) {
+ : profile_id_(0), id_(id), index_(index) {
}
bool BrowserActionDragData::IsFromProfile(Profile* profile) const {
- // An empty path means the data is not associated with any profile.
- return (!profile_path_.empty() &&
- profile_path_ == profile->GetPath().value());
+ return (profile_id_ == profile->GetRuntimeId());
}
#if defined(TOOLKIT_VIEWS)
@@ -69,25 +66,25 @@ OSExchangeData::CustomFormat
void BrowserActionDragData::WriteToPickle(
Profile* profile, Pickle* pickle) const {
- FilePath::WriteStringTypeToPickle(pickle, profile->GetPath().value());
+ ProfileId profile_id = profile->GetRuntimeId();
+ pickle->WriteBytes(&profile_id, sizeof(profile_id));
pickle->WriteString(id_);
- pickle->WriteInt(index_);
+ pickle->WriteSize(index_);
}
bool BrowserActionDragData::ReadFromPickle(Pickle* pickle) {
void* data_iterator = NULL;
- if (!FilePath::ReadStringTypeFromPickle(pickle, &data_iterator,
- &profile_path_)) {
+
+ const char* tmp;
+ if (!pickle->ReadBytes(&data_iterator, &tmp, sizeof(profile_id_)))
return false;
- }
+ memcpy(&profile_id_, tmp, sizeof(profile_id_));
if (!pickle->ReadString(&data_iterator, &id_))
return false;
- int index;
- if (!pickle->ReadInt(&data_iterator, &index))
+ if (!pickle->ReadSize(&data_iterator, &index_))
return false;
- index_ = index;
return true;
}
diff --git a/chrome/browser/views/extensions/browser_action_drag_data.h b/chrome/browser/views/extensions/browser_action_drag_data.h
index 8d5d514b..583185b 100644
--- a/chrome/browser/views/extensions/browser_action_drag_data.h
+++ b/chrome/browser/views/extensions/browser_action_drag_data.h
@@ -8,6 +8,7 @@
#include <string>
#include "base/basictypes.h"
+#include "chrome/browser/profile.h"
#if defined(TOOLKIT_VIEWS)
#include "app/os_exchange_data.h"
@@ -44,8 +45,8 @@ class BrowserActionDragData {
void WriteToPickle(Profile* profile, Pickle* pickle) const;
bool ReadFromPickle(Pickle* pickle);
- // Path of the profile we originated from.
- FilePath::StringType profile_path_;
+ // ID of the profile we originated from.
+ ProfileId profile_id_;
// The id of the view being dragged.
std::string id_;
diff --git a/chrome/browser/views/extensions/browser_action_drag_data_unittest.cc b/chrome/browser/views/extensions/browser_action_drag_data_unittest.cc
index 7f54b0c..da4eb2c 100644
--- a/chrome/browser/views/extensions/browser_action_drag_data_unittest.cc
+++ b/chrome/browser/views/extensions/browser_action_drag_data_unittest.cc
@@ -37,8 +37,9 @@ TEST_F(BrowserActionDragDataTest, BrowserActionDragDataFormat) {
profile.SetID(L"id");
const std::string extension_id = "42";
+ const ProfileId profile_id = profile.GetRuntimeId();
Pickle pickle;
- pickle.WriteWString(profile.GetPath().ToWStringHack());
+ pickle.WriteBytes(&profile_id, sizeof(profile_id));
pickle.WriteString(extension_id);
pickle.WriteInt(42);