| OLD | NEW | 
|    1 /* |    1 /* | 
|    2  * Copyright (C) 2008, 2010 Apple Inc. All rights reserved. |    2  * Copyright (C) 2008, 2010 Apple 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 |    5  * modification, are permitted provided that the following conditions | 
|    6  * are met: |    6  * are met: | 
|    7  * |    7  * | 
|    8  * 1.  Redistributions of source code must retain the above copyright |    8  * 1.  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  * 2.  Redistributions in binary form must reproduce the above copyright |   10  * 2.  Redistributions in binary form must reproduce the above copyright | 
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   42  |   42  | 
|   43 class LocalDOMWindow; |   43 class LocalDOMWindow; | 
|   44 class ExceptionState; |   44 class ExceptionState; | 
|   45 class Frame; |   45 class Frame; | 
|   46 class KURL; |   46 class KURL; | 
|   47  |   47  | 
|   48 // This class corresponds to the JS Location API, which is the only DOM API besi
     des Window that is operable |   48 // This class corresponds to the JS Location API, which is the only DOM API besi
     des Window that is operable | 
|   49 // in a RemoteFrame. Rather than making DOMWindowProperty support RemoteFrames a
     nd generating a lot |   49 // in a RemoteFrame. Rather than making DOMWindowProperty support RemoteFrames a
     nd generating a lot | 
|   50 // code churn, Location is implemented as a one-off with some custom lifetime ma
     nagement code. Namely, |   50 // code churn, Location is implemented as a one-off with some custom lifetime ma
     nagement code. Namely, | 
|   51 // it needs a manual call to reset() from DOMWindow::reset() to ensure it doesn'
     t retain a stale Frame pointer. |   51 // it needs a manual call to reset() from DOMWindow::reset() to ensure it doesn'
     t retain a stale Frame pointer. | 
|   52 class CORE_EXPORT Location final : public RefCountedWillBeGarbageCollected<Locat
     ion>, public ScriptWrappable { |   52 class CORE_EXPORT Location final : public GarbageCollected<Location>, public Scr
     iptWrappable { | 
|   53     DEFINE_WRAPPERTYPEINFO(); |   53     DEFINE_WRAPPERTYPEINFO(); | 
|   54 public: |   54 public: | 
|   55     static PassRefPtrWillBeRawPtr<Location> create(Frame* frame) |   55     static RawPtr<Location> create(Frame* frame) | 
|   56     { |   56     { | 
|   57         return adoptRefWillBeNoop(new Location(frame)); |   57         return new Location(frame); | 
|   58     } |   58     } | 
|   59  |   59  | 
|   60     Frame* frame() const { return m_frame.get(); } |   60     Frame* frame() const { return m_frame.get(); } | 
|   61     void reset() { m_frame = nullptr; } |   61     void reset() { m_frame = nullptr; } | 
|   62  |   62  | 
|   63     void setHref(LocalDOMWindow* currentWindow, LocalDOMWindow* enteredWindow, c
     onst String&); |   63     void setHref(LocalDOMWindow* currentWindow, LocalDOMWindow* enteredWindow, c
     onst String&); | 
|   64     String href() const; |   64     String href() const; | 
|   65  |   65  | 
|   66     void assign(LocalDOMWindow* currentWindow, LocalDOMWindow* enteredWindow, co
     nst String&, ExceptionState&); |   66     void assign(LocalDOMWindow* currentWindow, LocalDOMWindow* enteredWindow, co
     nst String&, ExceptionState&); | 
|   67     void replace(LocalDOMWindow* currentWindow, LocalDOMWindow* enteredWindow, c
     onst String&, ExceptionState&); |   67     void replace(LocalDOMWindow* currentWindow, LocalDOMWindow* enteredWindow, c
     onst String&, ExceptionState&); | 
|   68     void reload(LocalDOMWindow* currentWindow); |   68     void reload(LocalDOMWindow* currentWindow); | 
|   69  |   69  | 
|   70     void setProtocol(LocalDOMWindow* currentWindow, LocalDOMWindow* enteredWindo
     w, const String&, ExceptionState&); |   70     void setProtocol(LocalDOMWindow* currentWindow, LocalDOMWindow* enteredWindo
     w, const String&, ExceptionState&); | 
|   71     String protocol() const; |   71     String protocol() const; | 
|   72     void setHost(LocalDOMWindow* currentWindow, LocalDOMWindow* enteredWindow, c
     onst String&); |   72     void setHost(LocalDOMWindow* currentWindow, LocalDOMWindow* enteredWindow, c
     onst String&); | 
|   73     String host() const; |   73     String host() const; | 
|   74     void setHostname(LocalDOMWindow* currentWindow, LocalDOMWindow* enteredWindo
     w, const String&); |   74     void setHostname(LocalDOMWindow* currentWindow, LocalDOMWindow* enteredWindo
     w, const String&); | 
|   75     String hostname() const; |   75     String hostname() const; | 
|   76     void setPort(LocalDOMWindow* currentWindow, LocalDOMWindow* enteredWindow, c
     onst String&); |   76     void setPort(LocalDOMWindow* currentWindow, LocalDOMWindow* enteredWindow, c
     onst String&); | 
|   77     String port() const; |   77     String port() const; | 
|   78     void setPathname(LocalDOMWindow* currentWindow, LocalDOMWindow* enteredWindo
     w, const String&); |   78     void setPathname(LocalDOMWindow* currentWindow, LocalDOMWindow* enteredWindo
     w, const String&); | 
|   79     String pathname() const; |   79     String pathname() const; | 
|   80     void setSearch(LocalDOMWindow* currentWindow, LocalDOMWindow* enteredWindow,
      const String&); |   80     void setSearch(LocalDOMWindow* currentWindow, LocalDOMWindow* enteredWindow,
      const String&); | 
|   81     String search() const; |   81     String search() const; | 
|   82     void setHash(LocalDOMWindow* currentWindow, LocalDOMWindow* enteredWindow, c
     onst String&); |   82     void setHash(LocalDOMWindow* currentWindow, LocalDOMWindow* enteredWindow, c
     onst String&); | 
|   83     String hash() const; |   83     String hash() const; | 
|   84     String origin() const; |   84     String origin() const; | 
|   85  |   85  | 
|   86     PassRefPtrWillBeRawPtr<DOMStringList> ancestorOrigins() const; |   86     RawPtr<DOMStringList> ancestorOrigins() const; | 
|   87  |   87  | 
|   88     // Just return the |this| object the way the normal valueOf function on the 
     Object prototype would. |   88     // Just return the |this| object the way the normal valueOf function on the 
     Object prototype would. | 
|   89     // The valueOf function is only added to make sure that it cannot be overwri
     tten on location |   89     // The valueOf function is only added to make sure that it cannot be overwri
     tten on location | 
|   90     // objects, since that would provide a hook to change the string conversion 
     behavior of location objects. |   90     // objects, since that would provide a hook to change the string conversion 
     behavior of location objects. | 
|   91     ScriptValue valueOf(const ScriptValue& thisObject) { return thisObject; } |   91     ScriptValue valueOf(const ScriptValue& thisObject) { return thisObject; } | 
|   92  |   92  | 
|   93     DECLARE_VIRTUAL_TRACE(); |   93     DECLARE_VIRTUAL_TRACE(); | 
|   94  |   94  | 
|   95 private: |   95 private: | 
|   96     explicit Location(Frame*); |   96     explicit Location(Frame*); | 
|   97  |   97  | 
|   98     enum class SetLocation { Normal, ReplaceThisFrame }; |   98     enum class SetLocation { Normal, ReplaceThisFrame }; | 
|   99     void setLocation(const String&, LocalDOMWindow* currentWindow, LocalDOMWindo
     w* enteredWindow, ExceptionState* = nullptr, SetLocation = SetLocation::Normal); |   99     void setLocation(const String&, LocalDOMWindow* currentWindow, LocalDOMWindo
     w* enteredWindow, ExceptionState* = nullptr, SetLocation = SetLocation::Normal); | 
|  100  |  100  | 
|  101     const KURL& url() const; |  101     const KURL& url() const; | 
|  102  |  102  | 
|  103     RawPtrWillBeMember<Frame> m_frame; |  103     Member<Frame> m_frame; | 
|  104 }; |  104 }; | 
|  105  |  105  | 
|  106 } // namespace blink |  106 } // namespace blink | 
|  107  |  107  | 
|  108 #endif // Location_h |  108 #endif // Location_h | 
| OLD | NEW |