| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 #include "core/frame/Navigator.h" | 35 #include "core/frame/Navigator.h" |
| 36 #include "core/loader/FrameLoaderClient.h" | 36 #include "core/loader/FrameLoaderClient.h" |
| 37 | 37 |
| 38 namespace blink { | 38 namespace blink { |
| 39 | 39 |
| 40 NavigatorDoNotTrack::NavigatorDoNotTrack(LocalFrame* frame) | 40 NavigatorDoNotTrack::NavigatorDoNotTrack(LocalFrame* frame) |
| 41 : DOMWindowProperty(frame) | 41 : DOMWindowProperty(frame) |
| 42 { | 42 { |
| 43 } | 43 } |
| 44 | 44 |
| 45 DEFINE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(NavigatorDoNotTrack); | 45 NavigatorDoNotTrack::~NavigatorDoNotTrack() |
| 46 { |
| 47 } |
| 46 | 48 |
| 47 DEFINE_TRACE(NavigatorDoNotTrack) | 49 DEFINE_TRACE(NavigatorDoNotTrack) |
| 48 { | 50 { |
| 49 WillBeHeapSupplement<Navigator>::trace(visitor); | 51 HeapSupplement<Navigator>::trace(visitor); |
| 50 DOMWindowProperty::trace(visitor); | 52 DOMWindowProperty::trace(visitor); |
| 51 } | 53 } |
| 52 | 54 |
| 53 const char* NavigatorDoNotTrack::supplementName() | 55 const char* NavigatorDoNotTrack::supplementName() |
| 54 { | 56 { |
| 55 return "NavigatorDoNotTrack"; | 57 return "NavigatorDoNotTrack"; |
| 56 } | 58 } |
| 57 | 59 |
| 58 NavigatorDoNotTrack& NavigatorDoNotTrack::from(Navigator& navigator) | 60 NavigatorDoNotTrack& NavigatorDoNotTrack::from(Navigator& navigator) |
| 59 { | 61 { |
| 60 NavigatorDoNotTrack* supplement = static_cast<NavigatorDoNotTrack*>(WillBeHe
apSupplement<Navigator>::from(navigator, supplementName())); | 62 NavigatorDoNotTrack* supplement = static_cast<NavigatorDoNotTrack*>(HeapSupp
lement<Navigator>::from(navigator, supplementName())); |
| 61 if (!supplement) { | 63 if (!supplement) { |
| 62 supplement = new NavigatorDoNotTrack(navigator.frame()); | 64 supplement = new NavigatorDoNotTrack(navigator.frame()); |
| 63 provideTo(navigator, supplementName(), adoptPtrWillBeNoop(supplement)); | 65 provideTo(navigator, supplementName(), supplement); |
| 64 } | 66 } |
| 65 return *supplement; | 67 return *supplement; |
| 66 } | 68 } |
| 67 | 69 |
| 68 String NavigatorDoNotTrack::doNotTrack(Navigator& navigator) | 70 String NavigatorDoNotTrack::doNotTrack(Navigator& navigator) |
| 69 { | 71 { |
| 70 return NavigatorDoNotTrack::from(navigator).doNotTrack(); | 72 return NavigatorDoNotTrack::from(navigator).doNotTrack(); |
| 71 } | 73 } |
| 72 | 74 |
| 73 String NavigatorDoNotTrack::doNotTrack() | 75 String NavigatorDoNotTrack::doNotTrack() |
| 74 { | 76 { |
| 75 if (!frame() || !frame()->loader().client()) | 77 if (!frame() || !frame()->loader().client()) |
| 76 return String(); | 78 return String(); |
| 77 return frame()->loader().client()->doNotTrackValue(); | 79 return frame()->loader().client()->doNotTrackValue(); |
| 78 } | 80 } |
| 79 | 81 |
| 80 } // namespace blink | 82 } // namespace blink |
| OLD | NEW |