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

Side by Side Diff: chrome/browser/notifications/desktop_notification_service.cc

Issue 282693002: Add a null check for PermissionBubbleManager::FromWebcontents. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 7 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
« no previous file with comments | « chrome/browser/media/media_capture_devices_dispatcher.cc ('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 "chrome/browser/notifications/desktop_notification_service.h" 5 #include "chrome/browser/notifications/desktop_notification_service.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/prefs/scoped_user_pref_update.h" 9 #include "base/prefs/scoped_user_pref_update.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after
507 // notifications is "ask", show an infobar. 507 // notifications is "ask", show an infobar.
508 // The cache can only answer queries on the IO thread once it's initialized, 508 // The cache can only answer queries on the IO thread once it's initialized,
509 // so don't ask the cache. 509 // so don't ask the cache.
510 WebContents* web_contents = WebContents::FromRenderFrameHost( 510 WebContents* web_contents = WebContents::FromRenderFrameHost(
511 render_frame_host); 511 render_frame_host);
512 ContentSetting setting = GetContentSetting(origin); 512 ContentSetting setting = GetContentSetting(origin);
513 if (setting == CONTENT_SETTING_ASK) { 513 if (setting == CONTENT_SETTING_ASK) {
514 if (PermissionBubbleManager::Enabled()) { 514 if (PermissionBubbleManager::Enabled()) {
515 PermissionBubbleManager* bubble_manager = 515 PermissionBubbleManager* bubble_manager =
516 PermissionBubbleManager::FromWebContents(web_contents); 516 PermissionBubbleManager::FromWebContents(web_contents);
517 bubble_manager->AddRequest(new NotificationPermissionRequest( 517 if (bubble_manager) {
518 this, 518 bubble_manager->AddRequest(new NotificationPermissionRequest(
519 origin, 519 this,
520 DisplayNameForOriginInProcessId( 520 origin,
521 origin, render_frame_host->GetProcess()->GetID()), 521 DisplayNameForOriginInProcessId(
522 callback)); 522 origin, render_frame_host->GetProcess()->GetID()),
523 callback));
524 }
523 return; 525 return;
524 } 526 }
525 527
526 // Show an info bar requesting permission. 528 // Show an info bar requesting permission.
527 InfoBarService* infobar_service = 529 InfoBarService* infobar_service =
528 InfoBarService::FromWebContents(web_contents); 530 InfoBarService::FromWebContents(web_contents);
529 // |infobar_service| may be NULL, e.g., if this request originated in a 531 // |infobar_service| may be NULL, e.g., if this request originated in a
530 // browser action popup, extension background page, or any HTML that runs 532 // browser action popup, extension background page, or any HTML that runs
531 // outside of a tab. 533 // outside of a tab.
532 if (infobar_service) { 534 if (infobar_service) {
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
748 // Tell the IO thread that this extension's permission for notifications 750 // Tell the IO thread that this extension's permission for notifications
749 // has changed. 751 // has changed.
750 extensions::InfoMap* extension_info_map = 752 extensions::InfoMap* extension_info_map =
751 extensions::ExtensionSystem::Get(profile_)->info_map(); 753 extensions::ExtensionSystem::Get(profile_)->info_map();
752 BrowserThread::PostTask( 754 BrowserThread::PostTask(
753 BrowserThread::IO, FROM_HERE, 755 BrowserThread::IO, FROM_HERE,
754 base::Bind(&extensions::InfoMap::SetNotificationsDisabled, 756 base::Bind(&extensions::InfoMap::SetNotificationsDisabled,
755 extension_info_map, notifier_id.id, !enabled)); 757 extension_info_map, notifier_id.id, !enabled));
756 #endif 758 #endif
757 } 759 }
OLDNEW
« no previous file with comments | « chrome/browser/media/media_capture_devices_dispatcher.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698