OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #include "chrome/browser/android/shortcut_helper.h" | 5 #include "chrome/browser/android/shortcut_helper.h" |
6 | 6 |
7 #include <jni.h> | 7 #include <jni.h> |
8 #include <limits> | 8 #include <limits> |
9 | 9 |
10 #include "base/android/jni_android.h" | 10 #include "base/android/jni_android.h" |
11 #include "base/android/jni_string.h" | 11 #include "base/android/jni_string.h" |
12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
13 #include "base/location.h" | 13 #include "base/location.h" |
14 #include "base/strings/string16.h" | 14 #include "base/strings/string16.h" |
15 #include "base/strings/utf_string_conversions.h" | 15 #include "base/strings/utf_string_conversions.h" |
16 #include "base/task/cancelable_task_tracker.h" | 16 #include "base/task/cancelable_task_tracker.h" |
17 #include "base/threading/worker_pool.h" | 17 #include "base/threading/worker_pool.h" |
18 #include "chrome/browser/android/tab_android.h" | 18 #include "chrome/browser/android/tab_android.h" |
19 #include "chrome/browser/favicon/favicon_service.h" | 19 #include "chrome/browser/favicon/favicon_service.h" |
20 #include "chrome/browser/favicon/favicon_service_factory.h" | 20 #include "chrome/browser/favicon/favicon_service_factory.h" |
| 21 #include "chrome/browser/profiles/profile.h" |
21 #include "chrome/common/chrome_constants.h" | 22 #include "chrome/common/chrome_constants.h" |
22 #include "chrome/common/render_messages.h" | 23 #include "chrome/common/render_messages.h" |
23 #include "chrome/common/web_application_info.h" | 24 #include "chrome/common/web_application_info.h" |
24 #include "components/dom_distiller/core/url_utils.h" | 25 #include "components/dom_distiller/core/url_utils.h" |
25 #include "content/public/browser/user_metrics.h" | 26 #include "content/public/browser/user_metrics.h" |
26 #include "content/public/browser/web_contents.h" | 27 #include "content/public/browser/web_contents.h" |
27 #include "content/public/browser/web_contents_observer.h" | 28 #include "content/public/browser/web_contents_observer.h" |
28 #include "content/public/common/frame_navigate_params.h" | 29 #include "content/public/common/frame_navigate_params.h" |
29 #include "content/public/common/manifest.h" | 30 #include "content/public/common/manifest.h" |
30 #include "jni/ShortcutHelper_jni.h" | 31 #include "jni/ShortcutHelper_jni.h" |
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
378 Profile::FromBrowserContext(web_contents()->GetBrowserContext()); | 379 Profile::FromBrowserContext(web_contents()->GetBrowserContext()); |
379 | 380 |
380 // Grab the best, largest icon we can find to represent this bookmark. | 381 // Grab the best, largest icon we can find to represent this bookmark. |
381 // TODO(dfalcantara): Try combining with the new BookmarksHandler once its | 382 // TODO(dfalcantara): Try combining with the new BookmarksHandler once its |
382 // rewrite is further along. | 383 // rewrite is further along. |
383 std::vector<int> icon_types; | 384 std::vector<int> icon_types; |
384 icon_types.push_back(favicon_base::FAVICON); | 385 icon_types.push_back(favicon_base::FAVICON); |
385 icon_types.push_back(favicon_base::TOUCH_PRECOMPOSED_ICON | | 386 icon_types.push_back(favicon_base::TOUCH_PRECOMPOSED_ICON | |
386 favicon_base::TOUCH_ICON); | 387 favicon_base::TOUCH_ICON); |
387 FaviconService* favicon_service = FaviconServiceFactory::GetForProfile( | 388 FaviconService* favicon_service = FaviconServiceFactory::GetForProfile( |
388 profile, Profile::EXPLICIT_ACCESS); | 389 profile, ServiceAccessType::EXPLICIT_ACCESS); |
389 | 390 |
390 // Using favicon if its size is not smaller than platform required size, | 391 // Using favicon if its size is not smaller than platform required size, |
391 // otherwise using the largest icon among all avaliable icons. | 392 // otherwise using the largest icon among all avaliable icons. |
392 int threshold_to_get_any_largest_icon = preferred_icon_size_in_px_ - 1; | 393 int threshold_to_get_any_largest_icon = preferred_icon_size_in_px_ - 1; |
393 favicon_service->GetLargestRawFaviconForPageURL(url_, icon_types, | 394 favicon_service->GetLargestRawFaviconForPageURL(url_, icon_types, |
394 threshold_to_get_any_largest_icon, | 395 threshold_to_get_any_largest_icon, |
395 base::Bind(&ShortcutHelper::OnDidGetFavicon, | 396 base::Bind(&ShortcutHelper::OnDidGetFavicon, |
396 base::Unretained(this)), | 397 base::Unretained(this)), |
397 &cancelable_task_tracker_); | 398 &cancelable_task_tracker_); |
398 } | 399 } |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
482 base::android::GetApplicationContext(), | 483 base::android::GetApplicationContext(), |
483 java_url.obj(), | 484 java_url.obj(), |
484 java_title.obj(), | 485 java_title.obj(), |
485 java_bitmap.obj(), | 486 java_bitmap.obj(), |
486 r_value, | 487 r_value, |
487 g_value, | 488 g_value, |
488 b_value, | 489 b_value, |
489 display == content::Manifest::DISPLAY_MODE_STANDALONE, | 490 display == content::Manifest::DISPLAY_MODE_STANDALONE, |
490 orientation); | 491 orientation); |
491 } | 492 } |
OLD | NEW |