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

Side by Side Diff: chrome/browser/ui/webui/ntp/new_tab_page_handler.cc

Issue 10092017: Mac: Prevent NTP mousewheel events from being suppressed on Lion. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 8 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
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/ui/webui/ntp/new_tab_page_handler.h" 5 #include "chrome/browser/ui/webui/ntp/new_tab_page_handler.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/metrics/field_trial.h" 10 #include "base/metrics/field_trial.h"
11 #include "base/metrics/histogram.h" 11 #include "base/metrics/histogram.h"
12 #include "chrome/browser/browser_process.h" 12 #include "chrome/browser/browser_process.h"
13 #include "chrome/browser/extensions/default_apps_trial.h" 13 #include "chrome/browser/extensions/default_apps_trial.h"
14 #include "chrome/browser/prefs/pref_service.h" 14 #include "chrome/browser/prefs/pref_service.h"
15 #include "chrome/browser/profiles/profile.h" 15 #include "chrome/browser/profiles/profile.h"
16 #include "chrome/browser/sync/profile_sync_service.h" 16 #include "chrome/browser/sync/profile_sync_service.h"
17 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h" 17 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h"
18 #include "chrome/browser/web_resource/notification_promo.h" 18 #include "chrome/browser/web_resource/notification_promo.h"
19 #include "chrome/common/pref_names.h" 19 #include "chrome/common/pref_names.h"
20 #include "content/public/browser/notification_service.h" 20 #include "content/public/browser/notification_service.h"
21 #include "content/public/browser/web_ui.h" 21 #include "content/public/browser/web_ui.h"
22 #include "grit/chromium_strings.h" 22 #include "grit/chromium_strings.h"
23 #include "grit/generated_resources.h" 23 #include "grit/generated_resources.h"
24 #include "ui/base/l10n/l10n_util.h" 24 #include "ui/base/l10n/l10n_util.h"
25 25
26 #if defined(OS_MACOSX)
Patrick Dubroy 2012/04/16 21:27:59 Whoops. There should be no changes in this file.
27 #include "base/mac/mac_util.h"
28 #endif
29
26 static const int kIntroDisplayMax = 10; 30 static const int kIntroDisplayMax = 10;
27 31
28 // The URL of a knowledge-base article about the new NTP. 32 // The URL of a knowledge-base article about the new NTP.
29 static const char kNtp4IntroURL[] = 33 static const char kNtp4IntroURL[] =
30 "http://www.google.com/support/chrome/bin/answer.py?answer=95451"; 34 "http://www.google.com/support/chrome/bin/answer.py?answer=95451";
31 35
32 static const char kDefaultPageTypeHistogram[] = 36 static const char kDefaultPageTypeHistogram[] =
33 "NewTabPage.DefaultPageType"; 37 "NewTabPage.DefaultPageType";
34 38
35 NewTabPageHandler::NewTabPageHandler() : page_switch_count_(0) { 39 NewTabPageHandler::NewTabPageHandler() : page_switch_count_(0) {
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 local_state->SetInteger(prefs::kNtp4IntroDisplayCount, intro_displays); 187 local_state->SetInteger(prefs::kNtp4IntroDisplayCount, intro_displays);
184 } 188 }
185 if (intro_displays <= kIntroDisplayMax) { 189 if (intro_displays <= kIntroDisplayMax) {
186 values->SetString("ntp4_intro_message", 190 values->SetString("ntp4_intro_message",
187 l10n_util::GetStringUTF16(IDS_NTP4_INTRO_MESSAGE)); 191 l10n_util::GetStringUTF16(IDS_NTP4_INTRO_MESSAGE));
188 values->SetString("ntp4_intro_url", kNtp4IntroURL); 192 values->SetString("ntp4_intro_url", kNtp4IntroURL);
189 values->SetString("learn_more", 193 values->SetString("learn_more",
190 l10n_util::GetStringUTF16(IDS_LEARN_MORE)); 194 l10n_util::GetStringUTF16(IDS_LEARN_MORE));
191 } 195 }
192 #endif 196 #endif
197
198 LOG(WARNING) << "*********** ntp load";
199
200 // On Mac OS X 10.7+, horizontal scrolling can be treated as a back or
201 // forward gesture. Pass through a flag that indicates whether or not that
202 // feature is enabled.
203 #if defined(OS_MACOSX)
204 values->SetBoolean("isSwipeTrackingFromScrollEventsEnabled",
205 base::mac::IsSwipeTrackingFromScrollEventsEnabled());
206 #else
207 values->SetBoolean("isSwipeTrackingFromScrollEventsEnabled",
208 false);
209 #endif
193 } 210 }
194 211
195 // static 212 // static
196 void NewTabPageHandler::DismissIntroMessage(PrefService* prefs) { 213 void NewTabPageHandler::DismissIntroMessage(PrefService* prefs) {
197 prefs->SetInteger(prefs::kNtp4IntroDisplayCount, kIntroDisplayMax + 1); 214 prefs->SetInteger(prefs::kNtp4IntroDisplayCount, kIntroDisplayMax + 1);
198 // No need to send notification to update resource cache, because this method 215 // No need to send notification to update resource cache, because this method
199 // is only called during startup before the ntp resource cache is constructed. 216 // is only called during startup before the ntp resource cache is constructed.
200 } 217 }
201 218
202 void NewTabPageHandler::Notify(chrome::NotificationType notification_type) { 219 void NewTabPageHandler::Notify(chrome::NotificationType notification_type) {
203 content::NotificationService* service = 220 content::NotificationService* service =
204 content::NotificationService::current(); 221 content::NotificationService::current();
205 service->Notify(notification_type, 222 service->Notify(notification_type,
206 content::Source<NewTabPageHandler>(this), 223 content::Source<NewTabPageHandler>(this),
207 content::NotificationService::NoDetails()); 224 content::NotificationService::NoDetails());
208 } 225 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698