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.is_bookmark_app = true; | |
359 | |
360 // Add the downloaded icons. Extensions only allow certain icon sizes. First | 358 // Add the downloaded icons. Extensions only allow certain icon sizes. First |
361 // populate icons that match the allowed sizes exactly and then downscale | 359 // populate icons that match the allowed sizes exactly and then downscale |
362 // 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. |
363 std::set<int> allowed_sizes( | 361 std::set<int> allowed_sizes( |
364 extension_misc::kExtensionIconSizes, | 362 extension_misc::kExtensionIconSizes, |
365 extension_misc::kExtensionIconSizes + | 363 extension_misc::kExtensionIconSizes + |
366 extension_misc::kNumExtensionIconSizes); | 364 extension_misc::kNumExtensionIconSizes); |
367 std::vector<SkBitmap> downloaded_icons; | 365 std::vector<SkBitmap> downloaded_icons; |
368 for (FaviconDownloader::FaviconMap::const_iterator map_it = bitmaps.begin(); | 366 for (FaviconDownloader::FaviconMap::const_iterator map_it = bitmaps.begin(); |
369 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... |
689 } | 687 } |
690 } | 688 } |
691 | 689 |
692 void TabHelper::SetTabId(RenderViewHost* render_view_host) { | 690 void TabHelper::SetTabId(RenderViewHost* render_view_host) { |
693 render_view_host->Send( | 691 render_view_host->Send( |
694 new ExtensionMsg_SetTabId(render_view_host->GetRoutingID(), | 692 new ExtensionMsg_SetTabId(render_view_host->GetRoutingID(), |
695 SessionID::IdForTab(web_contents()))); | 693 SessionID::IdForTab(web_contents()))); |
696 } | 694 } |
697 | 695 |
698 } // namespace extensions | 696 } // namespace extensions |
OLD | NEW |