OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/libgtk2ui/gconf_listener.h" | 5 #include "chrome/browser/ui/libgtk2ui/gconf_listener.h" |
6 | 6 |
7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
8 | 8 |
| 9 #include <memory> |
| 10 |
9 #include "base/bind.h" | 11 #include "base/bind.h" |
10 #include "base/callback.h" | 12 #include "base/callback.h" |
11 #include "base/environment.h" | 13 #include "base/environment.h" |
12 #include "base/memory/scoped_ptr.h" | |
13 #include "base/nix/xdg_util.h" | 14 #include "base/nix/xdg_util.h" |
14 #include "base/strings/string_piece.h" | 15 #include "base/strings/string_piece.h" |
15 #include "base/strings/string_tokenizer.h" | 16 #include "base/strings/string_tokenizer.h" |
16 #include "chrome/browser/ui/libgtk2ui/gtk2_ui.h" | 17 #include "chrome/browser/ui/libgtk2ui/gtk2_ui.h" |
17 #include "ui/base/x/x11_util.h" | 18 #include "ui/base/x/x11_util.h" |
18 #include "ui/views/window/frame_buttons.h" | 19 #include "ui/views/window/frame_buttons.h" |
19 | 20 |
20 namespace { | 21 namespace { |
21 | 22 |
22 // The GConf key we read for the button placement string. Even through the key | 23 // The GConf key we read for the button placement string. Even through the key |
(...skipping 14 matching lines...) Expand all Loading... |
37 | 38 |
38 } // namespace | 39 } // namespace |
39 | 40 |
40 namespace libgtk2ui { | 41 namespace libgtk2ui { |
41 | 42 |
42 // Public interface: | 43 // Public interface: |
43 | 44 |
44 GConfListener::GConfListener(Gtk2UI* delegate) | 45 GConfListener::GConfListener(Gtk2UI* delegate) |
45 : delegate_(delegate), | 46 : delegate_(delegate), |
46 client_(NULL) { | 47 client_(NULL) { |
47 scoped_ptr<base::Environment> env(base::Environment::Create()); | 48 std::unique_ptr<base::Environment> env(base::Environment::Create()); |
48 base::nix::DesktopEnvironment de = | 49 base::nix::DesktopEnvironment de = |
49 base::nix::GetDesktopEnvironment(env.get()); | 50 base::nix::GetDesktopEnvironment(env.get()); |
50 if (de == base::nix::DESKTOP_ENVIRONMENT_GNOME || | 51 if (de == base::nix::DESKTOP_ENVIRONMENT_GNOME || |
51 de == base::nix::DESKTOP_ENVIRONMENT_UNITY || | 52 de == base::nix::DESKTOP_ENVIRONMENT_UNITY || |
52 ui::GuessWindowManager() == ui::WM_METACITY) { | 53 ui::GuessWindowManager() == ui::WM_METACITY) { |
53 client_ = gconf_client_get_default(); | 54 client_ = gconf_client_get_default(); |
54 // If we fail to get a context, that's OK, since we'll just fallback on | 55 // If we fail to get a context, that's OK, since we'll just fallback on |
55 // not receiving gconf keys. | 56 // not receiving gconf keys. |
56 if (client_) { | 57 if (client_) { |
57 // Register that we're interested in the values of this directory. | 58 // Register that we're interested in the values of this directory. |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 // value, we want to default to no action if the user has explicitly | 179 // value, we want to default to no action if the user has explicitly |
179 // chose an action that we don't implement. | 180 // chose an action that we don't implement. |
180 action = views::LinuxUI::MIDDLE_CLICK_ACTION_NONE; | 181 action = views::LinuxUI::MIDDLE_CLICK_ACTION_NONE; |
181 } | 182 } |
182 } | 183 } |
183 | 184 |
184 delegate_->SetNonClientMiddleClickAction(action); | 185 delegate_->SetNonClientMiddleClickAction(action); |
185 } | 186 } |
186 | 187 |
187 } // namespace libgtk2ui | 188 } // namespace libgtk2ui |
OLD | NEW |