Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(170)

Side by Side Diff: chrome/browser/android/blimp/blimp_contents_profile_attachment.cc

Issue 2166563003: Split //blimp/client/core to relevant parts. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@move-assignment-source
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 #include "chrome/browser/android/blimp/blimp_contents_profile_attachment.h" 5 #include "chrome/browser/android/blimp/blimp_contents_profile_attachment.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/supports_user_data.h" 8 #include "base/supports_user_data.h"
9 #include "blimp/client/public/blimp_contents.h" 9 #include "blimp/client/public/contents/blimp_contents.h"
10 10
11 namespace { 11 namespace {
12 const char kBlimpContentsProfileAttachment[] = 12 const char kBlimpContentsProfileAttachment[] =
13 "blimp_contents_profile_attachment"; 13 "blimp_contents_profile_attachment";
14 14
15 // A holder struct for a Profile that can be used as data. 15 // A holder struct for a Profile that can be used as data.
16 struct Attachment : public base::SupportsUserData::Data { 16 struct Attachment : public base::SupportsUserData::Data {
17 Profile* profile; 17 Profile* profile;
18 }; 18 };
19 19
20 } // namespace 20 } // namespace
21 21
22 void AttachProfileToBlimpContents(blimp::client::BlimpContents* blimp_contents, 22 void AttachProfileToBlimpContents(blimp::client::BlimpContents* blimp_contents,
23 Profile* profile) { 23 Profile* profile) {
24 DCHECK(profile); 24 DCHECK(profile);
25 Attachment* attachment = new Attachment; 25 Attachment* attachment = new Attachment;
26 attachment->profile = profile; 26 attachment->profile = profile;
27 blimp_contents->SetUserData(kBlimpContentsProfileAttachment, attachment); 27 blimp_contents->SetUserData(kBlimpContentsProfileAttachment, attachment);
28 } 28 }
29 29
30 Profile* GetProfileFromBlimpContents( 30 Profile* GetProfileFromBlimpContents(
31 blimp::client::BlimpContents* blimp_contents) { 31 blimp::client::BlimpContents* blimp_contents) {
32 Attachment* attachment = static_cast<Attachment*>( 32 Attachment* attachment = static_cast<Attachment*>(
33 blimp_contents->GetUserData(kBlimpContentsProfileAttachment)); 33 blimp_contents->GetUserData(kBlimpContentsProfileAttachment));
34 DCHECK(attachment); 34 DCHECK(attachment);
35 return attachment->profile; 35 return attachment->profile;
36 } 36 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698