Commit 5a991a2d authored by erg@chromium.org's avatar erg@chromium.org

Merge the LinuxUI interface from its own .so into libviews.so.

BUG=none

Review URL: https://chromiumcodereview.appspot.com/23922007

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@222239 0039d316-1c4b-4281-b951-d872f2087c98
parent 265415df
......@@ -10,7 +10,7 @@
#include "base/stl_util.h"
#if defined(OS_LINUX) && !defined(OS_CHROMEOS)
#include "ui/linux_ui/linux_ui.h"
#include "ui/views/linux_ui/linux_ui.h"
#endif
namespace {
......@@ -137,7 +137,7 @@ void DownloadStatusUpdater::OnDownloadUpdated(
void DownloadStatusUpdater::UpdateAppIconDownloadProgress(
content::DownloadItem* download) {
#if defined(OS_LINUX) && !defined(OS_CHROMEOS)
const ui::LinuxUI* linux_ui = ui::LinuxUI::instance();
const views::LinuxUI* linux_ui = views::LinuxUI::instance();
if (linux_ui) {
float progress = 0;
int download_count = 0;
......
......@@ -10,7 +10,7 @@
#include "chrome/browser/themes/custom_theme_supplier.h"
#include "chrome/common/pref_names.h"
#include "ui/gfx/image/image.h"
#include "ui/linux_ui/linux_ui.h"
#include "ui/views/linux_ui/linux_ui.h"
namespace {
......@@ -29,7 +29,7 @@ class NativeThemeX11 : public CustomThemeSupplier {
virtual ~NativeThemeX11();
// These pointers are not owned by us.
const ui::LinuxUI* const linux_ui_;
const views::LinuxUI* const linux_ui_;
PrefService* const pref_service_;
DISALLOW_COPY_AND_ASSIGN(NativeThemeX11);
......@@ -37,7 +37,7 @@ class NativeThemeX11 : public CustomThemeSupplier {
NativeThemeX11::NativeThemeX11(PrefService* pref_service)
: CustomThemeSupplier(NATIVE_X11),
linux_ui_(ui::LinuxUI::instance()),
linux_ui_(views::LinuxUI::instance()),
pref_service_(pref_service) {}
void NativeThemeX11::StartUsingTheme() {
......
......@@ -20,7 +20,7 @@
#if defined(USE_AURA) && defined(OS_LINUX) && !defined(OS_CHROMEOS)
#include "chrome/browser/themes/theme_service_aurax11.h"
#include "ui/linux_ui/linux_ui.h"
#include "ui/views/linux_ui/linux_ui.h"
#endif
// static
......@@ -74,7 +74,7 @@ void ThemeServiceFactory::RegisterProfilePrefs(
#if defined(TOOLKIT_GTK)
default_uses_system_theme = GtkThemeService::DefaultUsesSystemTheme();
#elif defined(USE_AURA) && defined(OS_LINUX) && !defined(OS_CHROMEOS)
const ui::LinuxUI* linux_ui = ui::LinuxUI::instance();
const views::LinuxUI* linux_ui = views::LinuxUI::instance();
if (linux_ui)
default_uses_system_theme = linux_ui->GetDefaultUsesSystemTheme();
#endif
......
......@@ -14,7 +14,7 @@
#if defined(OS_LINUX)
#include "chrome/browser/ui/libgtk2ui/gtk2_ui.h"
#include "ui/linux_ui/linux_ui.h"
#include "ui/views/linux_ui/linux_ui.h"
#else
#endif
......@@ -62,7 +62,7 @@ void ChromeBrowserMainExtraPartsAura::ToolkitInitialized() {
#if !defined(USE_ASH) && defined(OS_LINUX) && defined(USE_X11)
// TODO(erg): Refactor this into a dlopen call when we add a GTK3 port.
ui::LinuxUI::SetInstance(BuildGtk2UI());
views::LinuxUI::SetInstance(BuildGtk2UI());
#endif
}
......
......@@ -9,7 +9,7 @@
#include "base/memory/scoped_ptr.h"
#include "chrome/browser/ui/libgtk2ui/gtk2_signal.h"
#include "ui/base/models/menu_model.h"
#include "ui/linux_ui/status_icon_linux.h"
#include "ui/views/linux_ui/status_icon_linux.h"
typedef struct _AppIndicator AppIndicator;
typedef struct _GtkWidget GtkWidget;
......@@ -20,7 +20,7 @@ class ImageSkia;
namespace libgtk2ui {
class AppIndicatorIcon : public StatusIconLinux {
class AppIndicatorIcon : public views::StatusIconLinux {
public:
// The id uniquely identifies the new status icon from other chrome status
// icons.
......@@ -32,7 +32,7 @@ class AppIndicatorIcon : public StatusIconLinux {
// Indicates whether libappindicator so could be opened.
static bool CouldOpen();
// Overridden from StatusIconLinux:
// Overridden from views::StatusIconLinux:
virtual void SetImage(const gfx::ImageSkia& image) OVERRIDE;
virtual void SetPressedImage(const gfx::ImageSkia& image) OVERRIDE;
virtual void SetToolTip(const string16& tool_tip) OVERRIDE;
......
......@@ -395,17 +395,17 @@ bool Gtk2UI::IsStatusIconSupported() const {
return AppIndicatorIcon::CouldOpen();
}
scoped_ptr<StatusIconLinux> Gtk2UI::CreateLinuxStatusIcon(
scoped_ptr<views::StatusIconLinux> Gtk2UI::CreateLinuxStatusIcon(
const gfx::ImageSkia& image,
const string16& tool_tip) const {
if (AppIndicatorIcon::CouldOpen()) {
++indicators_count;
return scoped_ptr<StatusIconLinux>(new AppIndicatorIcon(
return scoped_ptr<views::StatusIconLinux>(new AppIndicatorIcon(
base::StringPrintf("%s%d", kAppIndicatorIdPrefix, indicators_count),
image,
tool_tip));
} else {
return scoped_ptr<StatusIconLinux>();
return scoped_ptr<views::StatusIconLinux>();
}
}
......@@ -1042,6 +1042,6 @@ void Gtk2UI::ClearAllThemeData() {
} // namespace libgtk2ui
ui::LinuxUI* BuildGtk2UI() {
views::LinuxUI* BuildGtk2UI() {
return new libgtk2ui::Gtk2UI;
}
......@@ -12,7 +12,7 @@
#include "chrome/browser/ui/libgtk2ui/libgtk2ui_export.h"
#include "chrome/browser/ui/libgtk2ui/owned_widget_gtk2.h"
#include "ui/gfx/color_utils.h"
#include "ui/linux_ui/linux_ui.h"
#include "ui/views/linux_ui/linux_ui.h"
typedef struct _GdkColor GdkColor;
typedef struct _GtkStyle GtkStyle;
......@@ -28,7 +28,7 @@ namespace libgtk2ui {
// Interface to GTK2 desktop features.
//
class Gtk2UI : public ui::LinuxUI {
class Gtk2UI : public views::LinuxUI {
public:
Gtk2UI();
virtual ~Gtk2UI();
......@@ -48,7 +48,7 @@ class Gtk2UI : public ui::LinuxUI {
virtual void SetDownloadCount(int count) const OVERRIDE;
virtual void SetProgressFraction(float percentage) const OVERRIDE;
virtual bool IsStatusIconSupported() const OVERRIDE;
virtual scoped_ptr<StatusIconLinux> CreateLinuxStatusIcon(
virtual scoped_ptr<views::StatusIconLinux> CreateLinuxStatusIcon(
const gfx::ImageSkia& image,
const string16& tool_tip) const OVERRIDE;
......@@ -170,6 +170,6 @@ class Gtk2UI : public ui::LinuxUI {
// interface, because eventually this .so will be loaded through dlopen at
// runtime so our main binary can conditionally load GTK2 or GTK3 or EFL or
// QT or whatever.
LIBGTK2UI_EXPORT ui::LinuxUI* BuildGtk2UI();
LIBGTK2UI_EXPORT views::LinuxUI* BuildGtk2UI();
#endif // CHROME_BROWSER_UI_LIBGTK2UI_GTK2_UI_H_
......@@ -18,7 +18,7 @@
'../../../../ui/base/strings/ui_strings.gyp:ui_strings',
'../../../../ui/ui.gyp:ui',
'../../../../ui/ui.gyp:ui_resources',
'../../../../ui/linux_ui/linux_ui.gyp:linux_ui',
'../../../../ui/views/views.gyp:views',
'../../../chrome_resources.gyp:chrome_extra_resources',
'../../../chrome_resources.gyp:chrome_resources',
'../../../chrome_resources.gyp:chrome_strings',
......
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/ui/views/status_icons/status_icon_linux_wrapper.h"
StatusIconLinuxWrapper::StatusIconLinuxWrapper(StatusIconLinux* status_icon)
#include "ui/views/linux_ui/linux_ui.h"
StatusIconLinuxWrapper::StatusIconLinuxWrapper(
views::StatusIconLinux* status_icon)
: menu_model_(NULL) {
status_icon_.reset(status_icon);
status_icon_->set_delegate(this);
......@@ -49,9 +51,9 @@ void StatusIconLinuxWrapper::OnMenuStateChanged() {
StatusIconLinuxWrapper* StatusIconLinuxWrapper::CreateWrappedStatusIcon(
const gfx::ImageSkia& image,
const string16& tool_tip) {
const ui::LinuxUI* linux_ui = ui::LinuxUI::instance();
const views::LinuxUI* linux_ui = views::LinuxUI::instance();
if (linux_ui) {
scoped_ptr<StatusIconLinux> status_icon =
scoped_ptr<views::StatusIconLinux> status_icon =
linux_ui->CreateLinuxStatusIcon(image, tool_tip);
if (status_icon.get())
return new StatusIconLinuxWrapper(status_icon.release());
......
......@@ -8,12 +8,12 @@
#include "base/memory/scoped_ptr.h"
#include "chrome/browser/status_icons/desktop_notification_balloon.h"
#include "chrome/browser/status_icons/status_icon.h"
#include "ui/linux_ui/linux_ui.h"
#include "ui/views/linux_ui/status_icon_linux.h"
// Wrapper class for StatusIconLinux that implements the standard StatusIcon
// interface. Also handles callbacks from StatusIconLinux.
class StatusIconLinuxWrapper : public StatusIcon,
public StatusIconLinux::Delegate,
public views::StatusIconLinux::Delegate,
public StatusIconMenuModel::Observer {
public:
virtual ~StatusIconLinuxWrapper();
......@@ -48,12 +48,12 @@ class StatusIconLinuxWrapper : public StatusIcon,
private:
// A status icon wrapper should only be created by calling
// CreateWrappedStatusIcon().
explicit StatusIconLinuxWrapper(StatusIconLinux* status_icon);
explicit StatusIconLinuxWrapper(views::StatusIconLinux* status_icon);
// Notification balloon.
DesktopNotificationBalloon notification_;
scoped_ptr<StatusIconLinux> status_icon_;
scoped_ptr<views::StatusIconLinux> status_icon_;
StatusIconMenuModel* menu_model_;
......
......@@ -4,9 +4,9 @@
#include "chrome/browser/ui/views/status_icons/status_tray_linux.h"
#ifndef OS_CHROMEOS
#if !defined(OS_CHROMEOS)
#include "chrome/browser/ui/views/status_icons/status_icon_linux_wrapper.h"
#include "ui/linux_ui/linux_ui.h"
#include "ui/views/linux_ui/linux_ui.h"
StatusTrayLinux::StatusTrayLinux() {
}
......@@ -22,14 +22,14 @@ StatusIcon* StatusTrayLinux::CreatePlatformStatusIcon(
}
StatusTray* StatusTray::Create() {
const ui::LinuxUI* linux_ui = ui::LinuxUI::instance();
const views::LinuxUI* linux_ui = views::LinuxUI::instance();
// Only create a status tray if we can actually create status icons.
if (linux_ui && linux_ui->IsStatusIconSupported())
return new StatusTrayLinux();
return NULL;
}
#else
#else // defined(OS_CHROMEOS)
StatusTray* StatusTray::Create() {
return NULL;
}
......
......@@ -2674,7 +2674,6 @@
# gtk2 is the only component that can interact with gtk2 in our new
# world.
'browser/ui/libgtk2ui/libgtk2ui.gyp:gtk2ui',
'../ui/linux_ui/linux_ui.gyp:linux_ui',
'../build/linux/system.gyp:gio',
],
}],
......
// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef UI_LINUX_UI_LINUX_UI_EXPORT_H_
#define UI_LINUX_UI_LINUX_UI_EXPORT_H_
// Defines LINUX_UI_EXPORT so that functionality implemented by the
// native_theme library can be exported to consumers.
#if defined(COMPONENT_BUILD)
#if defined(WIN32)
#if defined(LINUX_UI_IMPLEMENTATION)
#define LINUX_UI_EXPORT __declspec(dllexport)
#else
#define LINUX_UI_EXPORT __declspec(dllimport)
#endif // defined(LINUX_UI_IMPLEMENTATION)
#else // !defined(WIN32)
#if defined(LINUX_UI_IMPLEMENTATION)
#define LINUX_UI_EXPORT __attribute__((visibility("default")))
#else
#define LINUX_UI_EXPORT
#endif
#endif // defined(WIN32)
#else // !defined(COMPONENT_BUILD)
#define LINUX_UI_EXPORT
#endif // defined(COMPONENT_BUILD)
#endif // UI_LINUX_UI_LINUX_UI_EXPORT_H_
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ui/linux_ui/linux_ui.h"
#include "ui/views/linux_ui/linux_ui.h"
#include "ui/shell_dialogs/linux_shell_dialog.h"
namespace {
ui::LinuxUI* g_linux_ui = NULL;
views::LinuxUI* g_linux_ui = NULL;
} // namespace
namespace ui {
namespace views {
void LinuxUI::SetInstance(LinuxUI* instance) {
delete g_linux_ui;
......@@ -25,4 +25,4 @@ const LinuxUI* LinuxUI::instance() {
return g_linux_ui;
}
} // namespace ui
} // namespace views
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
......
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef UI_LINUX_UI_LINUX_UI_H_
#define UI_LINUX_UI_LINUX_UI_H_
#ifndef UI_VIEWS_LINUX_UI_LINUX_UI_H_
#define UI_VIEWS_LINUX_UI_LINUX_UI_H_
#include "third_party/skia/include/core/SkColor.h"
#include "ui/linux_ui/linux_ui_export.h"
#include "ui/linux_ui/status_icon_linux.h"
#include "ui/shell_dialogs/linux_shell_dialog.h"
#include "ui/views/linux_ui/status_icon_linux.h"
#include "ui/views/views_export.h"
// The main entrypoint into Linux toolkit specific code. GTK code should only
// be executed behind this interface.
......@@ -19,6 +19,9 @@ class Image;
namespace ui {
class NativeTheme;
}
namespace views {
// Adapter class with targets to render like different toolkits. Set by any
// project that wants to do linux desktop native rendering.
......@@ -27,10 +30,7 @@ class NativeTheme;
// minimum) GTK2 and GTK3. LinuxUI::instance() should actually be a very
// complex method that pokes around with dlopen against a libuigtk2.so, a
// liuigtk3.so, etc.
//
// TODO(erg): This class should be folded into ui/views/ instead of living in
// its own component once we've deleted out the GTK+ port.
class LINUX_UI_EXPORT LinuxUI : public LinuxShellDialog {
class VIEWS_EXPORT LinuxUI : public ui::LinuxShellDialog {
public:
virtual ~LinuxUI() {}
......@@ -52,7 +52,7 @@ class LINUX_UI_EXPORT LinuxUI : public LinuxShellDialog {
// Returns a NativeTheme that will provide system colors and draw system
// style widgets.
virtual NativeTheme* GetNativeTheme() const = 0;
virtual ui::NativeTheme* GetNativeTheme() const = 0;
// Returns whether we should be using the native theme provided by this
// object by default.
......@@ -72,6 +72,6 @@ class LINUX_UI_EXPORT LinuxUI : public LinuxShellDialog {
const string16& tool_tip) const = 0;
};
} // namespace ui
} // namespace views
#endif // UI_LINUX_UI_LINUX_UI_H_
#endif // UI_VIEWS_LINUX_UI_LINUX_UI_H_
......@@ -2,7 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ui/linux_ui/status_icon_linux.h"
#include "ui/views/linux_ui/status_icon_linux.h"
namespace views {
StatusIconLinux::Delegate::~Delegate() {
}
......@@ -15,3 +17,5 @@ StatusIconLinux::~StatusIconLinux() {
void StatusIconLinux::RefreshPlatformContextMenu() {
}
} // namespace views
......@@ -2,11 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef UI_LINUX_UI_STATUS_ICON_LINUX_H_
#define UI_LINUX_UI_STATUS_ICON_LINUX_H_
#ifndef UI_VIEWS_LINUX_UI_STATUS_ICON_LINUX_H_
#define UI_VIEWS_LINUX_UI_STATUS_ICON_LINUX_H_
#include "base/strings/string16.h"
#include "ui/linux_ui/linux_ui_export.h"
#include "ui/views/views_export.h"
namespace gfx {
class ImageSkia;
......@@ -16,11 +16,13 @@ namespace ui {
class MenuModel;
} // namespace ui
namespace views {
// Since liblinux_ui cannot have dependencies on any chrome browser components
// we cannot inherit from StatusIcon. So we implement the necessary methods
// and let a wrapper class implement the StatusIcon interface and defer the
// callbacks to a delegate. For the same reason, do not use StatusIconMenuModel.
class LINUX_UI_EXPORT StatusIconLinux {
class VIEWS_EXPORT StatusIconLinux {
public:
class Delegate {
public:
......@@ -55,4 +57,6 @@ class LINUX_UI_EXPORT StatusIconLinux {
Delegate* delegate_;
};
} // namespace views
#endif // UI_LINUX_UI_STATUS_ICON_LINUX_H_
......@@ -313,6 +313,10 @@
'layout/layout_constants.h',
'layout/layout_manager.cc',
'layout/layout_manager.h',
'linux_ui/linux_ui.h',
'linux_ui/linux_ui.cc',
'linux_ui/status_icon_linux.h',
'linux_ui/status_icon_linux.cc',
'metrics.cc',
'metrics.h',
'metrics_aura.cc',
......@@ -548,10 +552,13 @@
['include', 'accessibility/native_view_accessibility_win.h'],
],
}],
['use_aura==1 and OS=="linux" and chromeos==0', {
['OS=="linux" and chromeos==0', {
'dependencies': [
'../ui.gyp:shell_dialogs',
'../linux_ui/linux_ui.gyp:linux_ui',
],
}, { # OS=="linux" and chromeos==0
'sources/': [
['exclude', 'linux_ui'],
],
}],
['OS=="win"', {
......
......@@ -25,13 +25,13 @@
#include "ui/base/x/x11_util.h"
#include "ui/gfx/insets.h"
#include "ui/gfx/path_x11.h"
#include "ui/linux_ui/linux_ui.h"
#include "ui/native_theme/native_theme.h"
#include "ui/views/corewm/compound_event_filter.h"
#include "ui/views/corewm/corewm_switches.h"
#include "ui/views/corewm/cursor_manager.h"
#include "ui/views/corewm/focus_controller.h"
#include "ui/views/ime/input_method.h"
#include "ui/views/linux_ui/linux_ui.h"
#include "ui/views/widget/desktop_aura/desktop_cursor_loader_updater_aurax11.h"
#include "ui/views/widget/desktop_aura/desktop_dispatcher_client.h"
#include "ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11.h"
......@@ -1322,7 +1322,7 @@ DesktopRootWindowHost* DesktopRootWindowHost::Create(
// static
ui::NativeTheme* DesktopRootWindowHost::GetNativeTheme(aura::Window* window) {
const ui::LinuxUI* linux_ui = ui::LinuxUI::instance();
const views::LinuxUI* linux_ui = views::LinuxUI::instance();
if (linux_ui) {
ui::NativeTheme* native_theme = linux_ui->GetNativeTheme();
if (native_theme)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment