diff options
author | Kristian Monsen <kristianm@google.com> | 2011-05-11 20:53:37 +0100 |
---|---|---|
committer | Kristian Monsen <kristianm@google.com> | 2011-05-16 13:54:48 +0100 |
commit | 21d179b334e59e9a3bfcaed4c4430bef1bc5759d (patch) | |
tree | 64e2bb6da27af6a5c93ca34f6051584aafbfcb9e /chrome/browser/notifications | |
parent | 0c63f00edd6ed0482fd5cbcea937ca088baf7858 (diff) | |
download | external_chromium-21d179b334e59e9a3bfcaed4c4430bef1bc5759d.zip external_chromium-21d179b334e59e9a3bfcaed4c4430bef1bc5759d.tar.gz external_chromium-21d179b334e59e9a3bfcaed4c4430bef1bc5759d.tar.bz2 |
Merge Chromium at 10.0.621.0: Initial merge by git.
Change-Id: I070cc91c608dfa4a968a5a54c173260765ac8097
Diffstat (limited to 'chrome/browser/notifications')
10 files changed, 42 insertions, 25 deletions
diff --git a/chrome/browser/notifications/balloon_collection.cc b/chrome/browser/notifications/balloon_collection.cc index 9d60626..218126b 100644 --- a/chrome/browser/notifications/balloon_collection.cc +++ b/chrome/browser/notifications/balloon_collection.cc @@ -9,7 +9,7 @@ #include "chrome/browser/notifications/balloon.h" #include "chrome/browser/notifications/balloon_host.h" #include "chrome/browser/notifications/notification.h" -#include "chrome/browser/window_sizer.h" +#include "chrome/browser/ui/window_sizer.h" #include "gfx/rect.h" #include "gfx/size.h" diff --git a/chrome/browser/notifications/balloon_collection_mac.mm b/chrome/browser/notifications/balloon_collection_mac.mm index e3ac179..7615415 100644 --- a/chrome/browser/notifications/balloon_collection_mac.mm +++ b/chrome/browser/notifications/balloon_collection_mac.mm @@ -6,7 +6,7 @@ #import <Cocoa/Cocoa.h> -#include "chrome/browser/cocoa/notifications/balloon_view_bridge.h" +#include "chrome/browser/ui/cocoa/notifications/balloon_view_bridge.h" Balloon* BalloonCollectionImpl::MakeBalloon(const Notification& notification, Profile* profile) { diff --git a/chrome/browser/notifications/balloon_host.cc b/chrome/browser/notifications/balloon_host.cc index 6fbc1e0..d24f3d7 100644 --- a/chrome/browser/notifications/balloon_host.cc +++ b/chrome/browser/notifications/balloon_host.cc @@ -8,7 +8,7 @@ #include "chrome/browser/extensions/extension_process_manager.h" #include "chrome/browser/notifications/balloon.h" #include "chrome/browser/notifications/notification.h" -#include "chrome/browser/profile.h" +#include "chrome/browser/profiles/profile.h" #include "chrome/browser/renderer_host/render_view_host.h" #include "chrome/browser/renderer_host/site_instance.h" #include "chrome/browser/renderer_preferences_util.h" @@ -91,7 +91,8 @@ const string16& BalloonHost::GetSource() const { WebPreferences BalloonHost::GetWebkitPrefs() { WebPreferences web_prefs = - RenderViewHostDelegateHelper::GetWebkitPrefs(GetProfile(), enable_dom_ui_); + RenderViewHostDelegateHelper::GetWebkitPrefs(GetProfile(), + enable_dom_ui_); web_prefs.allow_scripts_to_close_windows = true; return web_prefs; } @@ -132,7 +133,9 @@ void BalloonHost::RenderViewReady(RenderViewHost* render_view_host) { Source<BalloonHost>(this), NotificationService::NoDetails()); } -void BalloonHost::RenderViewGone(RenderViewHost* render_view_host) { +void BalloonHost::RenderViewGone(RenderViewHost* render_view_host, + base::TerminationStatus status, + int error_code) { Close(render_view_host); } @@ -190,6 +193,11 @@ void BalloonHost::ShowCreatedWindow(int route_id, browser->AddTabContents(contents, disposition, initial_pos, user_gesture); } +bool BalloonHost::PreHandleKeyboardEvent(const NativeWebKeyboardEvent& event, + bool* is_keyboard_shortcut) { + return false; +} + void BalloonHost::UpdatePreferredSize(const gfx::Size& new_size) { balloon_->SetContentPreferredSize(new_size); } @@ -208,7 +216,7 @@ void BalloonHost::Init() { DCHECK(!render_view_host_) << "BalloonViewHost already initialized."; RenderViewHost* rvh = new RenderViewHost( site_instance_.get(), this, MSG_ROUTING_NONE, NULL); - if (GetProfile()->GetExtensionsService()) { + if (GetProfile()->GetExtensionService()) { extension_function_dispatcher_.reset( ExtensionFunctionDispatcher::Create( rvh, this, balloon_->notification().content_url())); diff --git a/chrome/browser/notifications/balloon_host.h b/chrome/browser/notifications/balloon_host.h index c5a88e7..358cb61 100644 --- a/chrome/browser/notifications/balloon_host.h +++ b/chrome/browser/notifications/balloon_host.h @@ -49,7 +49,9 @@ class BalloonHost : public RenderViewHostDelegate, virtual void Close(RenderViewHost* render_view_host); virtual void RenderViewCreated(RenderViewHost* render_view_host); virtual void RenderViewReady(RenderViewHost* render_view_host); - virtual void RenderViewGone(RenderViewHost* render_view_host); + virtual void RenderViewGone(RenderViewHost* render_view_host, + base::TerminationStatus status, + int error_code); virtual void UpdateTitle(RenderViewHost* render_view_host, int32 page_id, const std::wstring& title) {} virtual int GetBrowserWindowID() const; @@ -93,9 +95,7 @@ class BalloonHost : public RenderViewHostDelegate, virtual void Activate() {} virtual void Deactivate() {} virtual bool PreHandleKeyboardEvent(const NativeWebKeyboardEvent& event, - bool* is_keyboard_shortcut) { - return false; - } + bool* is_keyboard_shortcut); virtual void HandleKeyboardEvent(const NativeWebKeyboardEvent& event) {} virtual void HandleMouseMove() {} virtual void HandleMouseDown(); diff --git a/chrome/browser/notifications/desktop_notification_service.cc b/chrome/browser/notifications/desktop_notification_service.cc index 8aa82d1..afc01c7 100644 --- a/chrome/browser/notifications/desktop_notification_service.cc +++ b/chrome/browser/notifications/desktop_notification_service.cc @@ -11,14 +11,14 @@ #include "base/utf_string_conversions.h" #include "chrome/browser/browser_child_process_host.h" #include "chrome/browser/browser_thread.h" -#include "chrome/browser/extensions/extensions_service.h" +#include "chrome/browser/extensions/extension_service.h" #include "chrome/browser/notifications/notification.h" #include "chrome/browser/notifications/notification_object_proxy.h" #include "chrome/browser/notifications/notification_ui_manager.h" #include "chrome/browser/notifications/notifications_prefs_cache.h" #include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/prefs/scoped_pref_update.h" -#include "chrome/browser/profile.h" +#include "chrome/browser/profiles/profile.h" #include "chrome/browser/renderer_host/render_process_host.h" #include "chrome/browser/renderer_host/render_view_host.h" #include "chrome/browser/renderer_host/site_instance.h" @@ -317,7 +317,8 @@ void DesktopNotificationService::Observe(NotificationType type, } else if (NotificationType::EXTENSION_UNLOADED == type) { // Remove all notifications currently shown or queued by the extension // which was unloaded. - Extension* extension = Details<Extension>(details).ptr(); + const Extension* extension = + Details<UnloadedExtensionInfo>(details)->extension; if (extension) ui_manager_->CancelAllBySourceOrigin(extension->url()); } else if (NotificationType::PROFILE_DESTROYED == type) { @@ -452,6 +453,11 @@ void DesktopNotificationService::SetDefaultContentSetting( // The cache is updated through the notification observer. } +bool DesktopNotificationService::IsDefaultContentSettingManaged() const { + return profile_->GetPrefs()->IsManagedPreference( + prefs::kDesktopNotificationDefaultContentSetting); +} + void DesktopNotificationService::ResetToDefaultContentSetting() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); @@ -615,7 +621,7 @@ string16 DesktopNotificationService::DisplayNameForOrigin( const GURL& origin) { // If the source is an extension, lookup the display name. if (origin.SchemeIs(chrome::kExtensionScheme)) { - ExtensionsService* ext_service = profile_->GetExtensionsService(); + ExtensionService* ext_service = profile_->GetExtensionService(); if (ext_service) { const Extension* extension = ext_service->GetExtensionByURL(origin); if (extension) diff --git a/chrome/browser/notifications/desktop_notification_service.h b/chrome/browser/notifications/desktop_notification_service.h index a7a4ce2..bb6691b 100644 --- a/chrome/browser/notifications/desktop_notification_service.h +++ b/chrome/browser/notifications/desktop_notification_service.h @@ -93,6 +93,7 @@ class DesktopNotificationService : public NotificationObserver { // been allowed or denied yet. ContentSetting GetDefaultContentSetting(); void SetDefaultContentSetting(ContentSetting setting); + bool IsDefaultContentSettingManaged() const; // NOTE: This should only be called on the UI thread. void ResetToDefaultContentSetting(); diff --git a/chrome/browser/notifications/desktop_notification_service_unittest.cc b/chrome/browser/notifications/desktop_notification_service_unittest.cc index 3c1c8ca..4532dd2 100644 --- a/chrome/browser/notifications/desktop_notification_service_unittest.cc +++ b/chrome/browser/notifications/desktop_notification_service_unittest.cc @@ -4,8 +4,10 @@ #include "chrome/browser/notifications/desktop_notification_service.h" +#include "base/message_loop.h" #include "base/ref_counted.h" #include "base/waitable_event.h" +#include "chrome/browser/browser_thread.h" #include "chrome/browser/notifications/notifications_prefs_cache.h" #include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/prefs/scoped_pref_update.h" diff --git a/chrome/browser/notifications/notification_object_proxy.cc b/chrome/browser/notifications/notification_object_proxy.cc index 6b10afe..a973473 100644 --- a/chrome/browser/notifications/notification_object_proxy.cc +++ b/chrome/browser/notifications/notification_object_proxy.cc @@ -6,7 +6,6 @@ #include "base/message_loop.h" #include "base/string16.h" -#include "chrome/browser/browser_process.h" #include "chrome/browser/browser_thread.h" #include "chrome/browser/renderer_host/render_view_host.h" #include "chrome/common/render_messages.h" diff --git a/chrome/browser/notifications/notification_options_menu_model.cc b/chrome/browser/notifications/notification_options_menu_model.cc index 7172cf7..45620c9 100644 --- a/chrome/browser/notifications/notification_options_menu_model.cc +++ b/chrome/browser/notifications/notification_options_menu_model.cc @@ -8,11 +8,12 @@ #include "base/compiler_specific.h" #include "base/logging.h" #include "chrome/browser/browser_list.h" -#include "chrome/browser/extensions/extensions_service.h" +#include "chrome/browser/extensions/extension_service.h" #include "chrome/browser/notifications/desktop_notification_service.h" #include "chrome/browser/notifications/notification.h" #include "chrome/browser/notifications/notifications_prefs_cache.h" -#include "chrome/browser/profile.h" +#include "chrome/browser/profiles/profile.h" +#include "chrome/common/chrome_switches.h" #include "chrome/common/content_settings_types.h" #include "chrome/common/extensions/extension.h" #include "chrome/common/url_constants.h" @@ -20,7 +21,6 @@ #if defined(OS_WIN) #include "chrome/browser/ui/views/browser_dialogs.h" -#include "chrome/installer/util/install_util.h" #endif // OS_WIN // Menu commands @@ -54,7 +54,7 @@ NotificationOptionsMenuModel::NotificationOptionsMenuModel(Balloon* balloon) NotificationOptionsMenuModel::~NotificationOptionsMenuModel() { } -bool NotificationOptionsMenuModel::IsLabelForCommandIdDynamic(int command_id) +bool NotificationOptionsMenuModel::IsItemForCommandIdDynamic(int command_id) const { return command_id == kTogglePermissionCommand || command_id == kToggleExtensionCommand; @@ -72,8 +72,8 @@ string16 NotificationOptionsMenuModel::GetLabelForCommandId(int command_id) DesktopNotificationService* service = balloon_->profile()->GetDesktopNotificationService(); if (origin.SchemeIs(chrome::kExtensionScheme)) { - ExtensionsService* ext_service = - balloon_->profile()->GetExtensionsService(); + ExtensionService* ext_service = + balloon_->profile()->GetExtensionService(); const Extension* extension = ext_service->GetExtensionByURL(origin); if (extension) { ExtensionPrefs* extension_prefs = ext_service->extension_prefs(); @@ -121,8 +121,8 @@ bool NotificationOptionsMenuModel::GetAcceleratorForCommandId( void NotificationOptionsMenuModel::ExecuteCommand(int command_id) { DesktopNotificationService* service = balloon_->profile()->GetDesktopNotificationService(); - ExtensionsService* ext_service = - balloon_->profile()->GetExtensionsService(); + ExtensionService* ext_service = + balloon_->profile()->GetExtensionService(); const GURL& origin = balloon_->notification().origin_url(); switch (command_id) { case kTogglePermissionCommand: @@ -150,7 +150,8 @@ void NotificationOptionsMenuModel::ExecuteCommand(int command_id) { CONTENT_SETTINGS_TYPE_NOTIFICATIONS); } else { #if defined(OS_WIN) - if (InstallUtil::IsChromeFrameProcess()) { + if (CommandLine::ForCurrentProcess()->HasSwitch( + switches::kChromeFrame)) { // We may not have a browser if this is a chrome frame process. browser::ShowContentSettingsWindow(NULL, CONTENT_SETTINGS_TYPE_DEFAULT, diff --git a/chrome/browser/notifications/notification_options_menu_model.h b/chrome/browser/notifications/notification_options_menu_model.h index b276e11..f7f4c77 100644 --- a/chrome/browser/notifications/notification_options_menu_model.h +++ b/chrome/browser/notifications/notification_options_menu_model.h @@ -16,7 +16,7 @@ class NotificationOptionsMenuModel : public menus::SimpleMenuModel, virtual ~NotificationOptionsMenuModel(); // Overridden from menus::SimpleMenuModel: - virtual bool IsLabelForCommandIdDynamic(int command_id) const; + virtual bool IsItemForCommandIdDynamic(int command_id) const; virtual string16 GetLabelForCommandId(int command_id) const; // Overridden from menus::SimpleMenuModel::Delegate: |