| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 SCOPED_WEB_FRAME_H_ | 5 #ifndef SCOPED_WEB_FRAME_H_ |
| 6 #define SCOPED_WEB_FRAME_H_ | 6 #define SCOPED_WEB_FRAME_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "third_party/WebKit/public/web/WebFrameClient.h" |
| 9 #include "third_party/WebKit/public/web/WebLocalFrame.h" | 10 #include "third_party/WebKit/public/web/WebLocalFrame.h" |
| 10 #include "third_party/WebKit/public/web/WebView.h" | 11 #include "third_party/WebKit/public/web/WebView.h" |
| 11 | 12 |
| 12 namespace extensions { | 13 namespace extensions { |
| 13 | 14 |
| 14 // ScopedWebFrame is a class to create a dummy webview and frame for testing. | 15 // ScopedWebFrame is a class to create a dummy webview and frame for testing. |
| 15 // The dymmy webview and frame will be destructed when the scope exits. | 16 // The dymmy webview and frame will be destructed when the scope exits. |
| 16 class ScopedWebFrame { | 17 class ScopedWebFrame { |
| 17 public: | 18 public: |
| 18 ScopedWebFrame(); | 19 ScopedWebFrame(); |
| 19 ~ScopedWebFrame(); | 20 ~ScopedWebFrame(); |
| 20 | 21 |
| 21 blink::WebLocalFrame* frame() { return frame_; } | 22 blink::WebLocalFrame* frame() { return frame_; } |
| 22 | 23 |
| 23 private: | 24 private: |
| 24 // The webview and the frame are kept alive by the ScopedWebFrame | 25 blink::WebFrameClient frame_client_; |
| 25 // because they are not destructed unless ~ScopedWebFrame explicitly | 26 |
| 26 // closes the webview and the frame. | 27 // The webview and the frame are kept alive by the ScopedWebFrame |
| 27 blink::WebView* view_; | 28 // because they are not destructed unless ~ScopedWebFrame explicitly |
| 28 blink::WebLocalFrame* frame_; | 29 // closes the WebView. |
| 29 DISALLOW_COPY_AND_ASSIGN(ScopedWebFrame); | 30 blink::WebView* view_; |
| 31 blink::WebLocalFrame* frame_; |
| 32 |
| 33 DISALLOW_COPY_AND_ASSIGN(ScopedWebFrame); |
| 30 }; | 34 }; |
| 31 | 35 |
| 32 } // namespace extensions | 36 } // namespace extensions |
| 33 | 37 |
| 34 #endif // SCOPED_WEB_FRAME_H_ | 38 #endif // SCOPED_WEB_FRAME_H_ |
| OLD | NEW |