OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/extensions/tab_helper.h" | 5 #include "chrome/browser/extensions/tab_helper.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "chrome/browser/chrome_notification_types.h" | 10 #include "chrome/browser/chrome_notification_types.h" |
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
348 | 348 |
349 WebApplicationInfo install_info(web_app_info_); | 349 WebApplicationInfo install_info(web_app_info_); |
350 if (install_info.app_url.is_empty()) | 350 if (install_info.app_url.is_empty()) |
351 install_info.app_url = web_contents()->GetURL(); | 351 install_info.app_url = web_contents()->GetURL(); |
352 | 352 |
353 if (install_info.title.empty()) | 353 if (install_info.title.empty()) |
354 install_info.title = web_contents()->GetTitle(); | 354 install_info.title = web_contents()->GetTitle(); |
355 if (install_info.title.empty()) | 355 if (install_info.title.empty()) |
356 install_info.title = base::UTF8ToUTF16(install_info.app_url.spec()); | 356 install_info.title = base::UTF8ToUTF16(install_info.app_url.spec()); |
357 | 357 |
358 install_info.urls.push_back(install_info.app_url); | |
359 install_info.is_bookmark_app = true; | |
360 | |
361 // Add the downloaded icons. Extensions only allow certain icon sizes. First | 358 // Add the downloaded icons. Extensions only allow certain icon sizes. First |
362 // populate icons that match the allowed sizes exactly and then downscale | 359 // populate icons that match the allowed sizes exactly and then downscale |
363 // remaining icons to the closest allowed size that doesn't yet have an icon. | 360 // remaining icons to the closest allowed size that doesn't yet have an icon. |
364 std::set<int> allowed_sizes( | 361 std::set<int> allowed_sizes( |
365 extension_misc::kExtensionIconSizes, | 362 extension_misc::kExtensionIconSizes, |
366 extension_misc::kExtensionIconSizes + | 363 extension_misc::kExtensionIconSizes + |
367 extension_misc::kNumExtensionIconSizes); | 364 extension_misc::kNumExtensionIconSizes); |
368 std::vector<SkBitmap> downloaded_icons; | 365 std::vector<SkBitmap> downloaded_icons; |
369 for (FaviconDownloader::FaviconMap::const_iterator map_it = bitmaps.begin(); | 366 for (FaviconDownloader::FaviconMap::const_iterator map_it = bitmaps.begin(); |
370 map_it != bitmaps.end(); ++map_it) { | 367 map_it != bitmaps.end(); ++map_it) { |
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
690 } | 687 } |
691 } | 688 } |
692 | 689 |
693 void TabHelper::SetTabId(RenderViewHost* render_view_host) { | 690 void TabHelper::SetTabId(RenderViewHost* render_view_host) { |
694 render_view_host->Send( | 691 render_view_host->Send( |
695 new ExtensionMsg_SetTabId(render_view_host->GetRoutingID(), | 692 new ExtensionMsg_SetTabId(render_view_host->GetRoutingID(), |
696 SessionID::IdForTab(web_contents()))); | 693 SessionID::IdForTab(web_contents()))); |
697 } | 694 } |
698 | 695 |
699 } // namespace extensions | 696 } // namespace extensions |
OLD | NEW |