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

Side by Side Diff: chrome/browser/rlz/rlz.cc

Issue 7327007: Moving notification types which are chrome specific to a new header file chrome_notification_type... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 5 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 // This code glues the RLZ library DLL with Chrome. It allows Chrome to work 5 // This code glues the RLZ library DLL with Chrome. It allows Chrome to work
6 // with or without the DLL being present. If the DLL is not present the 6 // with or without the DLL being present. If the DLL is not present the
7 // functions do nothing and just return false. 7 // functions do nothing and just return false.
8 8
9 #include "chrome/browser/rlz/rlz.h" 9 #include "chrome/browser/rlz/rlz.h"
10 10
11 #include <process.h> 11 #include <process.h>
12 #include <windows.h> 12 #include <windows.h>
13 13
14 #include <algorithm> 14 #include <algorithm>
15 15
16 #include "base/file_path.h" 16 #include "base/file_path.h"
17 #include "base/message_loop.h" 17 #include "base/message_loop.h"
18 #include "base/path_service.h" 18 #include "base/path_service.h"
19 #include "base/string_util.h" 19 #include "base/string_util.h"
20 #include "base/synchronization/lock.h" 20 #include "base/synchronization/lock.h"
21 #include "base/task.h" 21 #include "base/task.h"
22 #include "base/threading/thread.h" 22 #include "base/threading/thread.h"
23 #include "base/threading/thread_restrictions.h" 23 #include "base/threading/thread_restrictions.h"
24 #include "base/utf_string_conversions.h" 24 #include "base/utf_string_conversions.h"
25 #include "chrome/browser/browser_process.h" 25 #include "chrome/browser/browser_process.h"
26 #include "chrome/browser/search_engines/template_url.h" 26 #include "chrome/browser/search_engines/template_url.h"
27 #include "chrome/browser/search_engines/template_url_service.h" 27 #include "chrome/browser/search_engines/template_url_service.h"
28 #include "chrome/browser/search_engines/template_url_service_factory.h" 28 #include "chrome/browser/search_engines/template_url_service_factory.h"
29 #include "chrome/common/chrome_notification_types.h"
29 #include "chrome/common/chrome_paths.h" 30 #include "chrome/common/chrome_paths.h"
30 #include "chrome/common/env_vars.h" 31 #include "chrome/common/env_vars.h"
31 #include "chrome/installer/util/google_update_settings.h" 32 #include "chrome/installer/util/google_update_settings.h"
32 #include "content/browser/browser_thread.h" 33 #include "content/browser/browser_thread.h"
33 #include "content/common/notification_registrar.h" 34 #include "content/common/notification_registrar.h"
34 #include "content/common/notification_service.h" 35 #include "content/common/notification_service.h"
35 36
36 namespace { 37 namespace {
37 38
38 // The maximum length of an access points RLZ in wide chars. 39 // The maximum length of an access points RLZ in wide chars.
(...skipping 25 matching lines...) Expand all
64 65
65 // This class leverages the AutocompleteEditModel notification to know when 66 // This class leverages the AutocompleteEditModel notification to know when
66 // the user first interacted with the omnibox and set a global accordingly. 67 // the user first interacted with the omnibox and set a global accordingly.
67 class OmniBoxUsageObserver : public NotificationObserver { 68 class OmniBoxUsageObserver : public NotificationObserver {
68 public: 69 public:
69 OmniBoxUsageObserver(bool first_run, bool send_ping_immediately, 70 OmniBoxUsageObserver(bool first_run, bool send_ping_immediately,
70 bool google_default_search) 71 bool google_default_search)
71 : first_run_(first_run), 72 : first_run_(first_run),
72 send_ping_immediately_(send_ping_immediately), 73 send_ping_immediately_(send_ping_immediately),
73 google_default_search_(google_default_search) { 74 google_default_search_(google_default_search) {
74 registrar_.Add(this, NotificationType::OMNIBOX_OPENED_URL, 75 registrar_.Add(this, chrome::NOTIFICATION_OMNIBOX_OPENED_URL,
75 NotificationService::AllSources()); 76 NotificationService::AllSources());
76 // If instant is enabled we'll start searching as soon as the user starts 77 // If instant is enabled we'll start searching as soon as the user starts
77 // typing in the omnibox (which triggers INSTANT_CONTROLLER_UPDATED). 78 // typing in the omnibox (which triggers INSTANT_CONTROLLER_UPDATED).
78 registrar_.Add(this, NotificationType::INSTANT_CONTROLLER_UPDATED, 79 registrar_.Add(this, chrome::NOTIFICATION_INSTANT_CONTROLLER_UPDATED,
79 NotificationService::AllSources()); 80 NotificationService::AllSources());
80 omnibox_used_ = false; 81 omnibox_used_ = false;
81 DCHECK(!instance_); 82 DCHECK(!instance_);
82 instance_ = this; 83 instance_ = this;
83 } 84 }
84 85
85 virtual void Observe(NotificationType type, 86 virtual void Observe(int type,
86 const NotificationSource& source, 87 const NotificationSource& source,
87 const NotificationDetails& details); 88 const NotificationDetails& details);
88 89
89 static bool used() { 90 static bool used() {
90 return omnibox_used_; 91 return omnibox_used_;
91 } 92 }
92 93
93 // Deletes the single instance of OmniBoxUsageObserver. 94 // Deletes the single instance of OmniBoxUsageObserver.
94 static void DeleteInstance() { 95 static void DeleteInstance() {
95 delete instance_; 96 delete instance_;
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 bool first_run_; 225 bool first_run_;
225 226
226 // True if Google is the default search engine for the first profile starting 227 // True if Google is the default search engine for the first profile starting
227 // in a browser during first run. 228 // in a browser during first run.
228 bool google_default_search_; 229 bool google_default_search_;
229 230
230 }; 231 };
231 232
232 bool DelayedInitTask::already_ran_ = false; 233 bool DelayedInitTask::already_ran_ = false;
233 234
234 void OmniBoxUsageObserver::Observe(NotificationType type, 235 void OmniBoxUsageObserver::Observe(int type,
235 const NotificationSource& source, 236 const NotificationSource& source,
236 const NotificationDetails& details) { 237 const NotificationDetails& details) {
237 // Needs to be evaluated. See http://crbug.com/62328. 238 // Needs to be evaluated. See http://crbug.com/62328.
238 base::ThreadRestrictions::ScopedAllowIO allow_io; 239 base::ThreadRestrictions::ScopedAllowIO allow_io;
239 240
240 // Try to record event now, else set the flag to try later when we 241 // Try to record event now, else set the flag to try later when we
241 // attempt the ping. 242 // attempt the ping.
242 if (!RLZTracker::RecordProductEvent(rlz_lib::CHROME, 243 if (!RLZTracker::RecordProductEvent(rlz_lib::CHROME,
243 rlz_lib::CHROME_OMNIBOX, 244 rlz_lib::CHROME_OMNIBOX,
244 rlz_lib::FIRST_SEARCH)) 245 rlz_lib::FIRST_SEARCH))
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 cached_ommibox_rlz.assign(*rlz); 340 cached_ommibox_rlz.assign(*rlz);
340 access_values_state = ACCESS_VALUES_FRESH; 341 access_values_state = ACCESS_VALUES_FRESH;
341 } 342 }
342 return true; 343 return true;
343 } 344 }
344 345
345 // static 346 // static
346 void RLZTracker::CleanupRlz() { 347 void RLZTracker::CleanupRlz() {
347 OmniBoxUsageObserver::DeleteInstance(); 348 OmniBoxUsageObserver::DeleteInstance();
348 } 349 }
OLDNEW
« no previous file with comments | « chrome/browser/repost_form_warning_controller.cc ('k') | chrome/browser/safe_browsing/client_side_detection_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698