Add 'did_proceed' and 'repeat_visit' to ClientMalwareReportRequest to track CTR.
[chromium-blink-merge.git] / components / web_view / frame_connection.h
blob2a1d29e5f1142c2cb2da64565b8b5d411f3ae977
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
3 // found in the LICENSE file.
5 #ifndef COMPONENTS_WEB_VIEW_FRAME_CONNECTION_H_
6 #define COMPONENTS_WEB_VIEW_FRAME_CONNECTION_H_
8 #include "base/basictypes.h"
9 #include "base/callback.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "components/mus/public/interfaces/view_tree.mojom.h"
12 #include "components/web_view/frame_tree_delegate.h"
13 #include "components/web_view/frame_user_data.h"
14 #include "components/web_view/public/interfaces/frame.mojom.h"
15 #include "mojo/services/network/public/interfaces/url_loader.mojom.h"
17 namespace mojo {
18 class ApplicationConnection;
19 class ApplicationImpl;
22 namespace web_view {
24 class Frame;
26 // FrameConnection is a FrameUserData that manages the connection to a
27 // particular frame. It is also responsible for obtaining the necessary
28 // services from the remote side.
29 class FrameConnection : public FrameUserData {
30 public:
31 FrameConnection();
32 ~FrameConnection() override;
34 // Creates a FrameConnection to service a call from
35 // FrameTreeDelegate::CanNavigateFrame(). |callback| is run once the
36 // content handler id for the app is determined.
37 static void CreateConnectionForCanNavigateFrame(
38 mojo::ApplicationImpl* app,
39 Frame* frame,
40 mojo::URLRequestPtr request,
41 const FrameTreeDelegate::CanNavigateFrameCallback& callback);
43 // Initializes the FrameConnection with the specified parameters.
44 // |on_got_id_callback| is run once the content handler is obtained from
45 // the connection.
46 void Init(mojo::ApplicationImpl* app,
47 mojo::URLRequestPtr request,
48 const base::Closure& on_got_id_callback);
50 mojom::FrameClient* frame_client() { return frame_client_.get(); }
52 mojo::ApplicationConnection* application_connection() {
53 return application_connection_.get();
56 // Asks the remote application for a ViewTreeClient.
57 mojo::ViewTreeClientPtr GetViewTreeClient();
59 // Returns the id of the content handler app. Only available once the callback
60 // has run.
61 uint32_t GetContentHandlerID() const;
63 private:
64 mojom::FrameClientPtr frame_client_;
66 scoped_ptr<mojo::ApplicationConnection> application_connection_;
68 DISALLOW_COPY_AND_ASSIGN(FrameConnection);
71 } // namespace web_view
73 #endif // COMPONENTS_WEB_VIEW_FRAME_CONNECTION_H_