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

Unified Diff: chrome/browser/extensions/api/experience_sampling_private/experience_sampling.cc

Issue 399773002: Experience sampling insturmentation for SSL and Safe Browsing interstitials (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@sampling-api
Patch Set: Clean up experience sampling header file changes Created 6 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/safe_browsing/safe_browsing_blocking_page.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/api/experience_sampling_private/experience_sampling.cc
diff --git a/chrome/browser/extensions/api/experience_sampling_private/experience_sampling.cc b/chrome/browser/extensions/api/experience_sampling_private/experience_sampling.cc
index f4b4e58414ab1b152cc0500986011a54667054e3..77c411a5e351a72a985d32b9ec70bfb7a2ed3fb0 100644
--- a/chrome/browser/extensions/api/experience_sampling_private/experience_sampling.cc
+++ b/chrome/browser/extensions/api/experience_sampling_private/experience_sampling.cc
@@ -61,7 +61,7 @@ void ExperienceSamplingEvent::CreateUserDecisionEvent(
const std::string& decision_name) {
// Check if this is from an incognito context. If it is, don't create and send
// any events.
- if (browser_context_->IsOffTheRecord())
+ if (browser_context_ && browser_context_->IsOffTheRecord())
return;
api::experience_sampling_private::UserDecision decision;
decision.name = decision_name;
@@ -74,19 +74,23 @@ void ExperienceSamplingEvent::CreateUserDecisionEvent(
args->Append(decision.ToValue().release());
scoped_ptr<Event> event(new Event(
api::experience_sampling_private::OnDecision::kEventName, args.Pass()));
- EventRouter::Get(browser_context_)->BroadcastEvent(event.Pass());
+ EventRouter* router = EventRouter::Get(browser_context_);
+ if (router)
+ router->BroadcastEvent(event.Pass());
}
void ExperienceSamplingEvent::CreateOnDisplayedEvent() {
// Check if this is from an incognito context. If it is, don't create and send
// any events.
- if (browser_context_->IsOffTheRecord())
+ if (browser_context_ && browser_context_->IsOffTheRecord())
return;
scoped_ptr<base::ListValue> args(new base::ListValue());
args->Append(ui_element_.ToValue().release());
scoped_ptr<Event> event(new Event(
api::experience_sampling_private::OnDisplayed::kEventName, args.Pass()));
- EventRouter::Get(browser_context_)->BroadcastEvent(event.Pass());
+ EventRouter* router = EventRouter::Get(browser_context_);
+ if (router)
+ router->BroadcastEvent(event.Pass());
}
} // namespace extensions
« no previous file with comments | « no previous file | chrome/browser/safe_browsing/safe_browsing_blocking_page.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698