Switch global error menu icon to vectorized MD asset
[chromium-blink-merge.git] / chrome / browser / android / tab_state.h
blob2b0182a5dba914b583761146c7af5057caad2cd7
1 // Copyright 2014 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 CHROME_BROWSER_ANDROID_TAB_STATE_H_
6 #define CHROME_BROWSER_ANDROID_TAB_STATE_H_
8 #include <jni.h>
9 #include <vector>
11 #include "base/android/scoped_java_ref.h"
13 namespace content {
14 class NavigationEntry;
15 class WebContents;
18 class TabAndroid;
20 // Stores state for a WebContents, including its navigation history.
21 class WebContentsState {
22 public:
23 static base::android::ScopedJavaLocalRef<jobject>
24 GetContentsStateAsByteBuffer(JNIEnv* env, TabAndroid* tab);
26 // Common implementation for GetContentsStateAsByteBuffer() and
27 // CreateContentsStateAsByteBuffer(). Does not assume ownership of the
28 // navigations.
29 static base::android::ScopedJavaLocalRef<jobject>
30 WriteNavigationsAsByteBuffer(
31 JNIEnv* env,
32 bool is_off_the_record,
33 const std::vector<content::NavigationEntry*>& navigations,
34 int current_entry);
36 // Extracts display title from serialized tab data on restore
37 static base::android::ScopedJavaLocalRef<jstring>
38 GetDisplayTitleFromByteBuffer(JNIEnv* env, void* data,
39 int size, int saved_state_version);
41 // Extracts virtual url from serialized tab data on restore
42 static base::android::ScopedJavaLocalRef<jstring>
43 GetVirtualUrlFromByteBuffer(JNIEnv* env, void* data,
44 int size, int saved_state_version);
46 // Restores a WebContents from the passed in state.
47 static content::WebContents* RestoreContentsFromByteBuffer(
48 void* data,
49 int size,
50 int saved_state_version,
51 bool initially_hidden);
53 // Restores a WebContents from the passed in state.
54 static base::android::ScopedJavaLocalRef<jobject>
55 RestoreContentsFromByteBuffer(JNIEnv* env,
56 jclass clazz,
57 jobject state,
58 jint saved_state_version,
59 jboolean initially_hidden);
61 // Synthesizes a stub, single-navigation state for a tab that will be loaded
62 // lazily.
63 static base::android::ScopedJavaLocalRef<jobject>
64 CreateSingleNavigationStateAsByteBuffer(JNIEnv* env, jstring url,
65 jstring referrer_url,
66 jint referrer_policy,
67 jboolean is_off_the_record);
70 // Registers methods for JNI.
71 bool RegisterTabState(JNIEnv* env);
73 #endif // CHROME_BROWSER_ANDROID_TAB_STATE_H_