summaryrefslogtreecommitdiffstats
path: root/chrome/browser/android/document/document_web_contents_delegate.cc
blob: a56362a28a02acdc537c6a23e682fdfacc3d012c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/browser/android/document/document_web_contents_delegate.h"

#include "components/web_contents_delegate_android/web_contents_delegate_android.h"
#include "content/public/browser/web_contents.h"
#include "jni/DocumentWebContentsDelegate_jni.h"

DocumentWebContentsDelegate::DocumentWebContentsDelegate(JNIEnv* env,
                                                         jobject obj)
    : WebContentsDelegateAndroid(env, obj) {
}

DocumentWebContentsDelegate::~DocumentWebContentsDelegate() {
}

void DocumentWebContentsDelegate::AttachContents(JNIEnv* env,
                                                 jobject jcaller,
                                                 jobject jweb_contents) {
  content::WebContents* web_contents =
      content::WebContents::FromJavaWebContents(jweb_contents);
  web_contents->SetDelegate(this);
}

bool DocumentWebContentsDelegate::Register(JNIEnv* env) {
  return RegisterNativesImpl(env);
}

void DocumentWebContentsDelegate::AddNewContents(
    content::WebContents* source,
    content::WebContents* new_contents,
    WindowOpenDisposition disposition,
    const gfx::Rect& initial_pos,
    bool user_gesture,
    bool* was_blocked) {
  NOTREACHED();
}

void DocumentWebContentsDelegate::CloseContents(content::WebContents* source) {
  NOTREACHED();
}

bool DocumentWebContentsDelegate::ShouldCreateWebContents(
    content::WebContents* web_contents,
    int route_id,
    int main_frame_route_id,
    WindowContainerType window_container_type,
    const std::string& frame_name,
    const GURL& target_url,
    const std::string& partition_id,
    content::SessionStorageNamespace* session_storage_namespace) {
  NOTREACHED();
  return false;
}


static jlong Initialize(JNIEnv* env, jobject obj) {
  return reinterpret_cast<intptr_t>(new DocumentWebContentsDelegate(env, obj));
}