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

Side by Side Diff: chrome/browser/chromeos/chrome_browser_main_chromeos.cc

Issue 7862020: chromeos: Add operations to monitor the screen orientation. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Rebased with fixed line endings in DEPS Created 9 years, 3 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) 2010 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 #include "chrome/browser/chromeos/chrome_browser_main_chromeos.h" 5 #include "chrome/browser/chromeos/chrome_browser_main_chromeos.h"
6 6
7 #include "base/bind.h"
8 #include "base/callback.h"
7 #include "base/command_line.h" 9 #include "base/command_line.h"
8 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
9 #include "base/message_loop.h" 11 #include "base/message_loop.h"
10 #include "chrome/browser/chromeos/boot_times_loader.h" 12 #include "chrome/browser/chromeos/boot_times_loader.h"
11 #include "chrome/browser/chromeos/cros/cros_library.h" 13 #include "chrome/browser/chromeos/cros/cros_library.h"
12 #include "chrome/browser/chromeos/net/cros_network_change_notifier_factory.h" 14 #include "chrome/browser/chromeos/net/cros_network_change_notifier_factory.h"
15 #include "chrome/browser/chromeos/sensors_source_chromeos.h"
13 #include "chrome/browser/defaults.h" 16 #include "chrome/browser/defaults.h"
14 #include "chrome/common/chrome_switches.h" 17 #include "chrome/common/chrome_switches.h"
15 #include "content/common/main_function_params.h" 18 #include "content/common/main_function_params.h"
16 #include "net/base/network_change_notifier.h" 19 #include "net/base/network_change_notifier.h"
17 20
18 #include <gtk/gtk.h> 21 #include <gtk/gtk.h>
19 22
23 namespace {
24
25 // Queued in PostMainMessageLoopStart. Needs to run after the IO thread is
26 // available via BrowserThread, as this is used by SensorsSourceChromeos.
27 void DoDeferredSensorsInit(sensors::SensorsSourceChromeos* source) {
28 if (!source->Init())
29 LOG(WARNING) << "Failed to initialize sensors source.";
30 }
31
32 } // namespace
33
20 class MessageLoopObserver : public MessageLoopForUI::Observer { 34 class MessageLoopObserver : public MessageLoopForUI::Observer {
21 virtual void WillProcessEvent(GdkEvent* event) { 35 virtual void WillProcessEvent(GdkEvent* event) {
22 // On chromeos we want to map Alt-left click to right click. 36 // On chromeos we want to map Alt-left click to right click.
23 // This code only changes presses and releases. We could decide to also 37 // This code only changes presses and releases. We could decide to also
24 // modify drags and crossings. It doesn't seem to be a problem right now 38 // modify drags and crossings. It doesn't seem to be a problem right now
25 // with our support for context menus (the only real need we have). 39 // with our support for context menus (the only real need we have).
26 // There are some inconsistent states both with what we have and what 40 // There are some inconsistent states both with what we have and what
27 // we would get if we added drags. You could get a right drag without a 41 // we would get if we added drags. You could get a right drag without a
28 // right down for example, unless we started synthesizing events, which 42 // right down for example, unless we started synthesizing events, which
29 // seems like more trouble than it's worth. 43 // seems like more trouble than it's worth.
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 // Replace the default NetworkChangeNotifierFactory with ChromeOS specific 100 // Replace the default NetworkChangeNotifierFactory with ChromeOS specific
87 // implementation. 101 // implementation.
88 net::NetworkChangeNotifier::SetFactory( 102 net::NetworkChangeNotifier::SetFactory(
89 new chromeos::CrosNetworkChangeNotifierFactory()); 103 new chromeos::CrosNetworkChangeNotifierFactory());
90 } 104 }
91 105
92 void ChromeBrowserMainPartsChromeos::PostMainMessageLoopStart() { 106 void ChromeBrowserMainPartsChromeos::PostMainMessageLoopStart() {
93 ChromeBrowserMainPartsPosix::PostMainMessageLoopStart(); 107 ChromeBrowserMainPartsPosix::PostMainMessageLoopStart();
94 MessageLoopForUI* message_loop = MessageLoopForUI::current(); 108 MessageLoopForUI* message_loop = MessageLoopForUI::current();
95 message_loop->AddObserver(g_message_loop_observer.Pointer()); 109 message_loop->AddObserver(g_message_loop_observer.Pointer());
110
111 if (parameters().command_line_.HasSwitch(switches::kEnableSensors)) {
112 sensors_source_ = new sensors::SensorsSourceChromeos();
113 // This initialization needs to be performed after BrowserThread::FILE is
114 // started. Post it into the current (UI) message loop, so that will be
115 // deferred until after browser main.
116 message_loop->PostTask(FROM_HERE,
117 base::Bind(&DoDeferredSensorsInit, sensors_source_));
118 }
96 } 119 }
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/chrome_browser_main_chromeos.h ('k') | chrome/browser/chromeos/login/login_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698