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/search/hotword_service.h" | 5 #include "chrome/browser/search/hotword_service.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/i18n/case_conversion.h" | 10 #include "base/i18n/case_conversion.h" |
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
420 if (!IsServiceAvailable() || IsAlwaysOnEnabled()) | 420 if (!IsServiceAvailable() || IsAlwaysOnEnabled()) |
421 return; | 421 return; |
422 | 422 |
423 message_center::RichNotificationData data; | 423 message_center::RichNotificationData data; |
424 const base::string16 label = l10n_util::GetStringUTF16( | 424 const base::string16 label = l10n_util::GetStringUTF16( |
425 IDS_HOTWORD_NOTIFICATION_BUTTON); | 425 IDS_HOTWORD_NOTIFICATION_BUTTON); |
426 data.buttons.push_back(message_center::ButtonInfo(label)); | 426 data.buttons.push_back(message_center::ButtonInfo(label)); |
427 | 427 |
428 Notification notification( | 428 Notification notification( |
429 message_center::NOTIFICATION_TYPE_SIMPLE, | 429 message_center::NOTIFICATION_TYPE_SIMPLE, |
430 GURL(), | |
431 l10n_util::GetStringUTF16(IDS_HOTWORD_NOTIFICATION_TITLE), | 430 l10n_util::GetStringUTF16(IDS_HOTWORD_NOTIFICATION_TITLE), |
432 l10n_util::GetStringUTF16(IDS_HOTWORD_NOTIFICATION_DESCRIPTION), | 431 l10n_util::GetStringUTF16(IDS_HOTWORD_NOTIFICATION_DESCRIPTION), |
433 ui::ResourceBundle::GetSharedInstance().GetImageNamed( | 432 ui::ResourceBundle::GetSharedInstance().GetImageNamed( |
434 IDR_HOTWORD_NOTIFICATION_ICON), | 433 IDR_HOTWORD_NOTIFICATION_ICON), |
435 message_center::NotifierId( | 434 message_center::NotifierId(message_center::NotifierId::SYSTEM_COMPONENT, |
436 message_center::NotifierId::SYSTEM_COMPONENT, | 435 hotword_internal::kHotwordNotifierId), |
437 hotword_internal::kHotwordNotifierId), | 436 base::string16(), GURL(), std::string(), data, |
438 base::string16(), | |
439 std::string(), | |
440 data, | |
441 new HotwordNotificationDelegate(profile_)); | 437 new HotwordNotificationDelegate(profile_)); |
442 | 438 |
443 g_browser_process->notification_ui_manager()->Add(notification, profile_); | 439 g_browser_process->notification_ui_manager()->Add(notification, profile_); |
444 profile_->GetPrefs()->SetBoolean( | 440 profile_->GetPrefs()->SetBoolean( |
445 prefs::kHotwordAlwaysOnNotificationSeen, true); | 441 prefs::kHotwordAlwaysOnNotificationSeen, true); |
446 } | 442 } |
447 | 443 |
448 void HotwordService::OnExtensionUninstalled( | 444 void HotwordService::OnExtensionUninstalled( |
449 content::BrowserContext* browser_context, | 445 content::BrowserContext* browser_context, |
450 const extensions::Extension* extension, | 446 const extensions::Extension* extension, |
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
875 // Only support multiple profiles and profile switching in ChromeOS. | 871 // Only support multiple profiles and profile switching in ChromeOS. |
876 if (user_manager::UserManager::IsInitialized()) { | 872 if (user_manager::UserManager::IsInitialized()) { |
877 user_manager::User* user = | 873 user_manager::User* user = |
878 user_manager::UserManager::Get()->GetActiveUser(); | 874 user_manager::UserManager::Get()->GetActiveUser(); |
879 if (user && user->is_profile_created()) | 875 if (user && user->is_profile_created()) |
880 return profile_ == ProfileManager::GetActiveUserProfile(); | 876 return profile_ == ProfileManager::GetActiveUserProfile(); |
881 } | 877 } |
882 #endif | 878 #endif |
883 return true; | 879 return true; |
884 } | 880 } |
OLD | NEW |