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

Side by Side Diff: chrome/browser/chromeos/accessibility/accessibility_manager.cc

Issue 2853913002: Fix crash when AccessibilityManager called when profile is nullptr (Closed)
Patch Set: Created 3 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 | « no previous file | 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/chromeos/accessibility/accessibility_manager.h" 5 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after
591 if (cl->HasSwitch(kAshDisableSystemSounds)) 591 if (cl->HasSwitch(kAshDisableSystemSounds))
592 return false; 592 return false;
593 if (option == PlaySoundOption::SPOKEN_FEEDBACK_ENABLED && 593 if (option == PlaySoundOption::SPOKEN_FEEDBACK_ENABLED &&
594 !IsSpokenFeedbackEnabled() && !cl->HasSwitch(kAshEnableSystemSounds)) { 594 !IsSpokenFeedbackEnabled() && !cl->HasSwitch(kAshEnableSystemSounds)) {
595 return false; 595 return false;
596 } 596 }
597 return media::SoundsManager::Get()->Play(sound_key); 597 return media::SoundsManager::Get()->Play(sound_key);
598 } 598 }
599 599
600 void AccessibilityManager::OnTwoFingerTouchStart() { 600 void AccessibilityManager::OnTwoFingerTouchStart() {
601 if (!profile())
oshima 2017/05/02 01:45:20 optional: just noticed that all other places are u
602 return;
603
601 extensions::EventRouter* event_router = 604 extensions::EventRouter* event_router =
602 extensions::EventRouter::Get(profile()); 605 extensions::EventRouter::Get(profile());
603 CHECK(event_router); 606 CHECK(event_router);
604 607
605 auto event_args = base::MakeUnique<base::ListValue>(); 608 auto event_args = base::MakeUnique<base::ListValue>();
606 auto event = base::MakeUnique<extensions::Event>( 609 auto event = base::MakeUnique<extensions::Event>(
607 extensions::events::ACCESSIBILITY_PRIVATE_ON_TWO_FINGER_TOUCH_START, 610 extensions::events::ACCESSIBILITY_PRIVATE_ON_TWO_FINGER_TOUCH_START,
608 extensions::api::accessibility_private::OnTwoFingerTouchStart::kEventName, 611 extensions::api::accessibility_private::OnTwoFingerTouchStart::kEventName,
609 std::move(event_args)); 612 std::move(event_args));
610 event_router->BroadcastEvent(std::move(event)); 613 event_router->BroadcastEvent(std::move(event));
611 } 614 }
612 615
613 void AccessibilityManager::OnTwoFingerTouchStop() { 616 void AccessibilityManager::OnTwoFingerTouchStop() {
617 if (!profile())
618 return;
619
614 extensions::EventRouter* event_router = 620 extensions::EventRouter* event_router =
615 extensions::EventRouter::Get(profile()); 621 extensions::EventRouter::Get(profile());
616 CHECK(event_router); 622 CHECK(event_router);
617 623
618 auto event_args = base::MakeUnique<base::ListValue>(); 624 auto event_args = base::MakeUnique<base::ListValue>();
619 auto event = base::MakeUnique<extensions::Event>( 625 auto event = base::MakeUnique<extensions::Event>(
620 extensions::events::ACCESSIBILITY_PRIVATE_ON_TWO_FINGER_TOUCH_STOP, 626 extensions::events::ACCESSIBILITY_PRIVATE_ON_TWO_FINGER_TOUCH_STOP,
621 extensions::api::accessibility_private::OnTwoFingerTouchStop::kEventName, 627 extensions::api::accessibility_private::OnTwoFingerTouchStop::kEventName,
622 std::move(event_args)); 628 std::move(event_args));
623 event_router->BroadcastEvent(std::move(event)); 629 event_router->BroadcastEvent(std::move(event));
(...skipping 906 matching lines...) Expand 10 before | Expand all | Expand 10 after
1530 content::BrowserContext* context) { 1536 content::BrowserContext* context) {
1531 keyboard_listener_extension_id_ = id; 1537 keyboard_listener_extension_id_ = id;
1532 1538
1533 extensions::ExtensionRegistry* registry = 1539 extensions::ExtensionRegistry* registry =
1534 extensions::ExtensionRegistry::Get(context); 1540 extensions::ExtensionRegistry::Get(context);
1535 if (!extension_registry_observer_.IsObserving(registry) && !id.empty()) 1541 if (!extension_registry_observer_.IsObserving(registry) && !id.empty())
1536 extension_registry_observer_.Add(registry); 1542 extension_registry_observer_.Add(registry);
1537 } 1543 }
1538 1544
1539 } // namespace chromeos 1545 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698