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

Side by Side Diff: third_party/WebKit/public/platform/WebCredential.h

Issue 1967693003: Avoid object slicing in WebCredential::create (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Adding the hilarious namespace :) Created 4 years, 7 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 WebCredential_h 5 #ifndef WebCredential_h
6 #define WebCredential_h 6 #define WebCredential_h
7 7
8 #include "public/platform/WebCommon.h" 8 #include "public/platform/WebCommon.h"
9 #include "public/platform/WebPrivatePtr.h" 9 #include "public/platform/WebPrivatePtr.h"
10 #include "public/platform/WebString.h" 10 #include "public/platform/WebString.h"
11 #include "public/platform/WebURL.h" 11 #include "public/platform/WebURL.h"
12 12
13 #include <memory>
14
13 namespace blink { 15 namespace blink {
14 16
15 class PlatformCredential; 17 class PlatformCredential;
16 18
17 class WebCredential { 19 class WebCredential {
18 public: 20 public:
19 BLINK_PLATFORM_EXPORT WebCredential(const WebString& id, const WebString& na me, const WebURL& iconURL); 21 BLINK_PLATFORM_EXPORT WebCredential(const WebString& id, const WebString& na me, const WebURL& iconURL);
20 BLINK_PLATFORM_EXPORT WebCredential(const WebCredential&); 22 BLINK_PLATFORM_EXPORT WebCredential(const WebCredential&);
21 virtual ~WebCredential() { reset(); } 23 virtual ~WebCredential() { reset(); }
22 24
23 BLINK_PLATFORM_EXPORT void assign(const WebCredential&); 25 BLINK_PLATFORM_EXPORT void assign(const WebCredential&);
24 BLINK_PLATFORM_EXPORT void reset(); 26 BLINK_PLATFORM_EXPORT void reset();
25 27
26 BLINK_PLATFORM_EXPORT WebString id() const; 28 BLINK_PLATFORM_EXPORT WebString id() const;
27 BLINK_PLATFORM_EXPORT WebString name() const; 29 BLINK_PLATFORM_EXPORT WebString name() const;
28 BLINK_PLATFORM_EXPORT WebURL iconURL() const; 30 BLINK_PLATFORM_EXPORT WebURL iconURL() const;
29 BLINK_PLATFORM_EXPORT WebString type() const; 31 BLINK_PLATFORM_EXPORT WebString type() const;
30 32
31 BLINK_PLATFORM_EXPORT bool isPasswordCredential() const; 33 BLINK_PLATFORM_EXPORT bool isPasswordCredential() const;
32 BLINK_PLATFORM_EXPORT bool isFederatedCredential() const; 34 BLINK_PLATFORM_EXPORT bool isFederatedCredential() const;
33 35
34 // TODO(mkwst): Drop this once Chromium is updated. https://crbug.com/494880 36 // TODO(mkwst): Drop this once Chromium is updated. https://crbug.com/494880
35 BLINK_PLATFORM_EXPORT bool isLocalCredential() const { return isPasswordCred ential(); } 37 BLINK_PLATFORM_EXPORT bool isLocalCredential() const { return isPasswordCred ential(); }
36 38
37 #if INSIDE_BLINK 39 #if INSIDE_BLINK
38 BLINK_PLATFORM_EXPORT static WebCredential create(PlatformCredential*); 40 BLINK_PLATFORM_EXPORT static std::unique_ptr<WebCredential> create(PlatformC redential*);
39 BLINK_PLATFORM_EXPORT WebCredential& operator=(PlatformCredential*); 41 BLINK_PLATFORM_EXPORT WebCredential& operator=(PlatformCredential*);
40 BLINK_PLATFORM_EXPORT PlatformCredential* getPlatformCredential() const { re turn m_platformCredential.get(); } 42 BLINK_PLATFORM_EXPORT PlatformCredential* getPlatformCredential() const { re turn m_platformCredential.get(); }
41 #endif 43 #endif
42 44
43 protected: 45 protected:
44 #if INSIDE_BLINK 46 #if INSIDE_BLINK
45 BLINK_PLATFORM_EXPORT WebCredential(PlatformCredential*); 47 BLINK_PLATFORM_EXPORT WebCredential(PlatformCredential*);
46 #endif 48 #endif
47 49
48 WebPrivatePtr<PlatformCredential> m_platformCredential; 50 WebPrivatePtr<PlatformCredential> m_platformCredential;
49 }; 51 };
50 52
51 } // namespace blink 53 } // namespace blink
52 54
53 #endif // WebCredential_h 55 #endif // WebCredential_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698