Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(418)

Side by Side Diff: win8/metro_driver/secondary_tile.cc

Issue 10914160: Manually merging remaining Win8 changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « win8/metro_driver/metro_driver.gyp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "stdafx.h" 5 #include "stdafx.h"
6 #include "secondary_tile.h" 6 #include "secondary_tile.h"
7 7
8 #include <windows.ui.startscreen.h> 8 #include <windows.ui.startscreen.h>
9 9
10 #include "base/base_paths.h" 10 #include "base/base_paths.h"
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/file_path.h" 12 #include "base/file_path.h"
13 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "base/path_service.h" 14 #include "base/path_service.h"
15 #include "base/string_number_conversions.h" 15 #include "base/string_number_conversions.h"
16 #include "base/utf_string_conversions.h" 16 #include "base/utf_string_conversions.h"
17 #include "crypto/sha2.h" 17 #include "crypto/sha2.h"
18 #include "googleurl/src/gurl.h"
18 #include "win8/metro_driver/chrome_app_view.h" 19 #include "win8/metro_driver/chrome_app_view.h"
19 #include "win8/metro_driver/winrt_utils.h" 20 #include "win8/metro_driver/winrt_utils.h"
20 21
21 namespace { 22 namespace {
22 23
23 string16 GenerateTileId(const string16& url_str) { 24 string16 GenerateTileId(const string16& url_str) {
24 uint8 hash[crypto::kSHA256Length]; 25 uint8 hash[crypto::kSHA256Length];
25 crypto::SHA256HashString(UTF16ToUTF8(url_str), hash, sizeof(hash)); 26 crypto::SHA256HashString(UTF16ToUTF8(url_str), hash, sizeof(hash));
26 std::string hash_str = base::HexEncode(hash, sizeof(hash)); 27 std::string hash_str = base::HexEncode(hash, sizeof(hash));
27 return UTF8ToUTF16(hash_str); 28 return UTF8ToUTF16(hash_str);
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 tile_factory.GetAddressOf()); 85 tile_factory.GetAddressOf());
85 CheckHR(hr, "Failed to create instance of ISecondaryTileFactory"); 86 CheckHR(hr, "Failed to create instance of ISecondaryTileFactory");
86 87
87 winui::StartScreen::TileOptions options = 88 winui::StartScreen::TileOptions options =
88 winui::StartScreen::TileOptions_ShowNameOnLogo; 89 winui::StartScreen::TileOptions_ShowNameOnLogo;
89 mswrw::HString title; 90 mswrw::HString title;
90 title.Attach(MakeHString(title_str)); 91 title.Attach(MakeHString(title_str));
91 mswrw::HString id; 92 mswrw::HString id;
92 id.Attach(MakeHString(GenerateTileId(url_str))); 93 id.Attach(MakeHString(GenerateTileId(url_str)));
93 mswrw::HString args; 94 mswrw::HString args;
94 args.Attach(MakeHString(string16(L"url=").append(url_str))); 95 // The url is just passed into the tile agruments as is. Metro and desktop
96 // chrome will see the arguments as command line parameters.
97 // A GURL is used to ensure any spaces are properly escaped.
98 GURL url(url_str);
99 args.Attach(MakeHString(UTF8ToUTF16(url.spec())));
95 100
96 mswr::ComPtr<winfoundtn::IUriRuntimeClassFactory> uri_factory; 101 mswr::ComPtr<winfoundtn::IUriRuntimeClassFactory> uri_factory;
97 hr = winrt_utils::CreateActivationFactory( 102 hr = winrt_utils::CreateActivationFactory(
98 RuntimeClass_Windows_Foundation_Uri, 103 RuntimeClass_Windows_Foundation_Uri,
99 uri_factory.GetAddressOf()); 104 uri_factory.GetAddressOf());
100 CheckHR(hr, "Failed to create URIFactory"); 105 CheckHR(hr, "Failed to create URIFactory");
101 106
102 mswrw::HString logo_url; 107 mswrw::HString logo_url;
103 logo_url.Attach(MakeHString(GetLogoUrlString())); 108 logo_url.Attach(MakeHString(GetLogoUrlString()));
104 mswr::ComPtr<winfoundtn::IUriRuntimeClass> uri; 109 mswr::ComPtr<winfoundtn::IUriRuntimeClass> uri;
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 VLOG(1) << __FUNCTION__ << " url: " << url; 151 VLOG(1) << __FUNCTION__ << " url: " << url;
147 return IsPinnedToStartScreen(url); 152 return IsPinnedToStartScreen(url);
148 } 153 }
149 154
150 void MetroTogglePinnedToStartScreen(const string16& title, 155 void MetroTogglePinnedToStartScreen(const string16& title,
151 const string16& url) { 156 const string16& url) {
152 DVLOG(1) << __FUNCTION__ << " title:" << title << " url: " << url; 157 DVLOG(1) << __FUNCTION__ << " title:" << title << " url: " << url;
153 globals.appview_msg_loop->PostTask( 158 globals.appview_msg_loop->PostTask(
154 FROM_HERE, base::Bind(&TogglePinnedToStartScreen, title, url)); 159 FROM_HERE, base::Bind(&TogglePinnedToStartScreen, title, url));
155 } 160 }
OLDNEW
« no previous file with comments | « win8/metro_driver/metro_driver.gyp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698