| 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 <string> | 5 #include <string> |
| 6 | 6 |
| 7 #include "win8/metro_driver/stdafx.h" | 7 #include "win8/metro_driver/stdafx.h" |
| 8 #include "win8/metro_driver/toast_notification_handler.h" | 8 #include "win8/metro_driver/toast_notification_handler.h" |
| 9 | 9 |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 hr = elements->Item(index, node); | 57 hr = elements->Item(index, node); |
| 58 CheckHR(hr); | 58 CheckHR(hr); |
| 59 return hr; | 59 return hr; |
| 60 } | 60 } |
| 61 | 61 |
| 62 // Helper function to append a text element to the text section in the | 62 // Helper function to append a text element to the text section in the |
| 63 // XML document passed in. | 63 // XML document passed in. |
| 64 // The index parameter identifies which text node we append to. | 64 // The index parameter identifies which text node we append to. |
| 65 HRESULT CreateTextNode(winxml::Dom::IXmlDocument* xml_doc, | 65 HRESULT CreateTextNode(winxml::Dom::IXmlDocument* xml_doc, |
| 66 int index, | 66 int index, |
| 67 const string16& text_string) { | 67 const base::string16& text_string) { |
| 68 DCHECK(xml_doc); | 68 DCHECK(xml_doc); |
| 69 | 69 |
| 70 mswr::ComPtr<winxml::Dom::IXmlElement> document_element; | 70 mswr::ComPtr<winxml::Dom::IXmlElement> document_element; |
| 71 HRESULT hr = xml_doc->get_DocumentElement(&document_element); | 71 HRESULT hr = xml_doc->get_DocumentElement(&document_element); |
| 72 CheckHR(hr); | 72 CheckHR(hr); |
| 73 | 73 |
| 74 mswr::ComPtr<winxml::Dom::IXmlText> xml_text_node; | 74 mswr::ComPtr<winxml::Dom::IXmlText> xml_text_node; |
| 75 mswrw::HString data_hstring; | 75 mswrw::HString data_hstring; |
| 76 data_hstring.Attach(MakeHString(text_string.c_str())); | 76 data_hstring.Attach(MakeHString(text_string.c_str())); |
| 77 hr = xml_doc->CreateTextNode(data_hstring.Get(), &xml_text_node); | 77 hr = xml_doc->CreateTextNode(data_hstring.Get(), &xml_text_node); |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 | 199 |
| 200 base::FilePath chrome_path; | 200 base::FilePath chrome_path; |
| 201 if (!PathService::Get(base::FILE_EXE, &chrome_path)) { | 201 if (!PathService::Get(base::FILE_EXE, &chrome_path)) { |
| 202 NOTREACHED() << "Failed to get chrome exe path"; | 202 NOTREACHED() << "Failed to get chrome exe path"; |
| 203 return; | 203 return; |
| 204 } | 204 } |
| 205 | 205 |
| 206 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); | 206 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); |
| 207 bool is_per_user_install = InstallUtil::IsPerUserInstall( | 207 bool is_per_user_install = InstallUtil::IsPerUserInstall( |
| 208 chrome_path.value().c_str()); | 208 chrome_path.value().c_str()); |
| 209 string16 appid = ShellUtil::GetBrowserModelId(dist, is_per_user_install); | 209 base::string16 appid = |
| 210 ShellUtil::GetBrowserModelId(dist, is_per_user_install); |
| 210 DVLOG(1) << "Chrome Appid is " << appid.c_str(); | 211 DVLOG(1) << "Chrome Appid is " << appid.c_str(); |
| 211 | 212 |
| 212 mswrw::HString app_user_model_id; | 213 mswrw::HString app_user_model_id; |
| 213 app_user_model_id.Attach(MakeHString(appid)); | 214 app_user_model_id.Attach(MakeHString(appid)); |
| 214 | 215 |
| 215 hr = toast_manager->CreateToastNotifierWithId(app_user_model_id.Get(), | 216 hr = toast_manager->CreateToastNotifierWithId(app_user_model_id.Get(), |
| 216 ¬ifier_); | 217 ¬ifier_); |
| 217 CheckHR(hr); | 218 CheckHR(hr); |
| 218 | 219 |
| 219 hr = notification_->add_Activated( | 220 hr = notification_->add_Activated( |
| (...skipping 23 matching lines...) Expand all Loading... |
| 243 // etc to ChromeAppView which would enable it to ensure that the | 244 // etc to ChromeAppView which would enable it to ensure that the |
| 244 // correct tab in chrome is activated. | 245 // correct tab in chrome is activated. |
| 245 DVLOG(1) << __FUNCTION__; | 246 DVLOG(1) << __FUNCTION__; |
| 246 | 247 |
| 247 if (notification_info_.notification_handler) { | 248 if (notification_info_.notification_handler) { |
| 248 notification_info_.notification_handler( | 249 notification_info_.notification_handler( |
| 249 notification_info_.notification_context.c_str()); | 250 notification_info_.notification_context.c_str()); |
| 250 } | 251 } |
| 251 return S_OK; | 252 return S_OK; |
| 252 } | 253 } |
| OLD | NEW |