summaryrefslogtreecommitdiffstats
path: root/chrome/browser/android/shortcut_helper.h
blob: 90543da8b56824a5d6361e216b7720bd125e0207 (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
// Copyright 2013 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.

#ifndef CHROME_BROWSER_ANDROID_SHORTCUT_HELPER_H_
#define CHROME_BROWSER_ANDROID_SHORTCUT_HELPER_H_

#include "base/android/jni_helper.h"
#include "base/basictypes.h"
#include "base/strings/string16.h"
#include "chrome/browser/android/tab_android.h"

namespace chrome {
struct FaviconBitmapResult;
}  // namespace chrome

namespace content {
class WebContents;
}  // namespace content

class GURL;

// Adds a shortcut to the current URL to the Android home screen.
class ShortcutHelper {
 public:
  // Adds a shortcut to the current URL to the Android home screen, firing
  // background tasks to pull all the data required.
  static void AddShortcut(content::WebContents* web_contents);

  // Registers JNI hooks.
  static bool RegisterShortcutHelper(JNIEnv* env);

  // Adds a shortcut to the launcher.
  static void FinishAddingShortcut(
      const GURL& url,
      const base::string16& title,
      bool is_webapp_capable,
      const chrome::FaviconBitmapResult& bitmap_result);

 private:
  // Adds a shortcut to the launcher in the background.
  static void FinishAddingShortcutInBackground(
      const GURL& url,
      const base::string16& title,
      bool is_webapp_capable,
      const chrome::FaviconBitmapResult& bitmap_result);

  DISALLOW_COPY_AND_ASSIGN(ShortcutHelper);
};

#endif  // CHROME_BROWSER_ANDROID_SHORTCUT_HELPER_H_