diff options
114 files changed, 1083 insertions, 889 deletions
diff --git a/build/common.gypi b/build/common.gypi index 54d0e16..c50b175 100644 --- a/build/common.gypi +++ b/build/common.gypi @@ -886,6 +886,12 @@ }, }, }], + # TODO(darin): Unfortunately, some third_party code depends on base/ + [ 'OS=="win" and component=="shared_library"', { + 'msvs_disabled_warnings': [ + 4251, # class 'std::xx' needs to have dll-interface. + ], + }], [ 'OS=="mac"', { 'xcode_settings': { 'GCC_TREAT_WARNINGS_AS_ERRORS': 'NO', diff --git a/chrome/app/chrome_main.cc b/chrome/app/chrome_main.cc index 79fcc62..c45916c8 100644 --- a/chrome/app/chrome_main.cc +++ b/chrome/app/chrome_main.cc @@ -49,6 +49,7 @@ #if defined(OS_WIN) #include <algorithm> +#include <atlbase.h> #include <malloc.h> #include "base/string_util.h" #include "base/win/registry.h" @@ -773,6 +774,11 @@ int ChromeMain(int argc, char** argv) { // done in all processes that work with these URLs (i.e. including renderers). chrome::RegisterChromeSchemes(); +#if defined(OS_WIN) + // TODO(darin): Kill this once http://crbug.com/52609 is fixed. + ResourceBundle::SetResourcesDataDLL(_AtlBaseModule.GetResourceInstance()); +#endif + if (SubprocessNeedsResourceBundle(process_type)) { // Initialize ResourceBundle which handles files loaded from external // sources. The language should have been passed in to us from the diff --git a/chrome/chrome.gyp b/chrome/chrome.gyp index 83e8ea5..2235bc3 100644 --- a/chrome/chrome.gyp +++ b/chrome/chrome.gyp @@ -1189,7 +1189,7 @@ 'dependencies': [ 'chrome_strings', '../base/base.gyp:base', - '../ui/ui.gyp:ui_base', + '../ui/ui.gyp:ui', ], 'include_dirs': [ '<(grit_out_dir)', diff --git a/chrome/chrome_common.gypi b/chrome/chrome_common.gypi index a6ddcd2..9ae0e21 100644 --- a/chrome/chrome_common.gypi +++ b/chrome/chrome_common.gypi @@ -529,7 +529,7 @@ '../base/base.gyp:base_nacl_win64', '../ipc/ipc.gyp:ipc_win64', '../third_party/libxml/libxml.gyp:libxml', - '../ui/ui.gyp:ui_base_nacl_win64', + '../ui/ui.gyp:ui_nacl_win64', '../ui/ui.gyp:ui_resources', ], 'include_dirs': [ diff --git a/content/content_browser.gypi b/content/content_browser.gypi index 37e20bd..00041d3 100644 --- a/content/content_browser.gypi +++ b/content/content_browser.gypi @@ -18,7 +18,7 @@ '../third_party/speex/speex.gyp:libspeex', '../third_party/WebKit/Source/WebKit/chromium/WebKit.gyp:webkit', '../third_party/zlib/zlib.gyp:zlib', - '../ui/ui.gyp:ui_base', + '../ui/ui.gyp:ui', '../ui/ui.gyp:ui_resources', '../webkit/support/webkit_support.gyp:webkit_resources', '../webkit/support/webkit_support.gyp:webkit_strings', diff --git a/content/content_common.gypi b/content/content_common.gypi index 5a85be8..f010b60 100644 --- a/content/content_common.gypi +++ b/content/content_common.gypi @@ -17,7 +17,7 @@ '../third_party/npapi/npapi.gyp:npapi', '../third_party/WebKit/Source/WebKit/chromium/WebKit.gyp:webkit', '../ui/gfx/gl/gl.gyp:gl', - '../ui/ui.gyp:ui_base', + '../ui/ui.gyp:ui', '../webkit/support/webkit_support.gyp:appcache', '../webkit/support/webkit_support.gyp:blob', '../webkit/support/webkit_support.gyp:database', diff --git a/gpu/demos/demos.gyp b/gpu/demos/demos.gyp index d257304..26d2230 100644 --- a/gpu/demos/demos.gyp +++ b/gpu/demos/demos.gyp @@ -42,6 +42,8 @@ '../gpu.gyp:command_buffer_client', '../gpu.gyp:command_buffer_service', '../../base/base.gyp:base', + '../../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations', + '../../ui/ui.gyp:ui', ], 'sources': [ 'framework/main_exe.cc', diff --git a/gpu/gles2_conform_support/gles2_conform_support.gyp b/gpu/gles2_conform_support/gles2_conform_support.gyp index a3493e3..d75462b 100644 --- a/gpu/gles2_conform_support/gles2_conform_support.gyp +++ b/gpu/gles2_conform_support/gles2_conform_support.gyp @@ -72,6 +72,7 @@ 'type': 'executable', 'dependencies': [ 'egl_native', + '<(DEPTH)/base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations', '<(DEPTH)/gpu/gpu.gyp:gles2_c_lib_nocheck', '<(DEPTH)/third_party/expat/expat.gyp:expat', ], diff --git a/gpu/gpu.gyp b/gpu/gpu.gyp index acbee7f..22f0215 100644 --- a/gpu/gpu.gyp +++ b/gpu/gpu.gyp @@ -186,7 +186,7 @@ '../base/base.gyp:base', '../ui/gfx/gl/gl.gyp:gl', '../ui/gfx/surface/surface.gyp:surface', - '../ui/ui.gyp:ui_gfx', + '../ui/ui.gyp:ui', '../third_party/angle/src/build_angle.gyp:translator_glsl', ], 'sources': [ @@ -254,6 +254,7 @@ 'target_name': 'gpu_unittests', 'type': 'executable', 'dependencies': [ + '../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations', '../testing/gmock.gyp:gmock', '../testing/gmock.gyp:gmock_main', '../testing/gtest.gyp:gtest', @@ -371,6 +372,7 @@ 'target_name': 'gles2_demo', 'type': 'executable', 'dependencies': [ + '../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations', 'command_buffer_service', 'gles2_demo_lib', ], diff --git a/printing/printing.gyp b/printing/printing.gyp index 55bc9b5..f9f18e7 100644 --- a/printing/printing.gyp +++ b/printing/printing.gyp @@ -18,7 +18,7 @@ '../skia/skia.gyp:skia', '../third_party/icu/icu.gyp:icui18n', '../third_party/icu/icu.gyp:icuuc', - '../ui/ui.gyp:ui_base', # Only required for Font support. + '../ui/ui.gyp:ui', # Only required for Font support. ], 'include_dirs': [ '..', diff --git a/remoting/remoting.gyp b/remoting/remoting.gyp index 8ce526a..560c4af 100644 --- a/remoting/remoting.gyp +++ b/remoting/remoting.gyp @@ -231,7 +231,7 @@ 'dependencies': [ '../base/base.gyp:base', '../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations', - '../ui/ui.gyp:ui_gfx', + '../ui/ui.gyp:ui', '../net/net.gyp:net', '../third_party/protobuf/protobuf.gyp:protobuf_lite', '../third_party/libvpx/libvpx.gyp:libvpx_include', @@ -679,7 +679,7 @@ '../base/base.gyp:base_i18n', '../base/base.gyp:test_support_base', '../media/media.gyp:media', - '../ui/ui.gyp:ui_gfx', + '../ui/ui.gyp:ui', '../testing/gmock.gyp:gmock', '../testing/gtest.gyp:gtest', ], diff --git a/tools/imagediff/image_diff.gyp b/tools/imagediff/image_diff.gyp index 9ac72d3..6d4a620 100644 --- a/tools/imagediff/image_diff.gyp +++ b/tools/imagediff/image_diff.gyp @@ -12,7 +12,7 @@ 'type': 'executable', 'dependencies': [ '../../base/base.gyp:base', - '../../ui/ui.gyp:ui_gfx', + '../../ui/ui.gyp:ui', ], 'sources': [ 'image_diff.cc', diff --git a/tools/memory_watcher/memory_watcher.gyp b/tools/memory_watcher/memory_watcher.gyp index 47fb49c..feed6f8 100644 --- a/tools/memory_watcher/memory_watcher.gyp +++ b/tools/memory_watcher/memory_watcher.gyp @@ -9,7 +9,7 @@ 'type': 'shared_library', 'dependencies': [ '../../base/base.gyp:base', - '../../ui/ui.gyp:ui_base', + '../../ui/ui.gyp:ui', ], 'defines': [ 'BUILD_MEMORY_WATCHER', diff --git a/ui/base/accessibility/accessible_view_state.h b/ui/base/accessibility/accessible_view_state.h index 6bae897..c5117ac 100644 --- a/ui/base/accessibility/accessible_view_state.h +++ b/ui/base/accessibility/accessible_view_state.h @@ -9,6 +9,7 @@ #include "base/basictypes.h" #include "base/string16.h" #include "ui/base/accessibility/accessibility_types.h" +#include "ui/ui_api.h" namespace ui { @@ -20,7 +21,7 @@ namespace ui { // that should be provided about any UI view to assistive technology (AT). // //////////////////////////////////////////////////////////////////////////////// -struct AccessibleViewState { +struct UI_API AccessibleViewState { public: AccessibleViewState(); ~AccessibleViewState(); diff --git a/ui/base/animation/animation.h b/ui/base/animation/animation.h index 272f093..8de0f0c6a 100644 --- a/ui/base/animation/animation.h +++ b/ui/base/animation/animation.h @@ -25,7 +25,7 @@ class AnimationDelegate; // // To subclass override Step, which is invoked as the animation progresses and // GetCurrentValue() to return the value appropriate to the animation. -class Animation : public AnimationContainerElement { +class UI_API Animation : public AnimationContainerElement { public: explicit Animation(base::TimeDelta timer_interval); virtual ~Animation(); diff --git a/ui/base/animation/animation_container.h b/ui/base/animation/animation_container.h index 3e7a458..04c3f0d 100644 --- a/ui/base/animation/animation_container.h +++ b/ui/base/animation/animation_container.h @@ -11,6 +11,7 @@ #include "base/memory/ref_counted.h" #include "base/time.h" #include "base/timer.h" +#include "ui/ui_api.h" namespace ui { @@ -25,7 +26,8 @@ class AnimationContainerObserver; // // AnimationContainer is ref counted. Each Animation contained within the // AnimationContainer own it. -class AnimationContainer : public base::RefCounted<AnimationContainer> { +class UI_API AnimationContainer + : public base::RefCounted<AnimationContainer> { public: AnimationContainer(); diff --git a/ui/base/animation/animation_container_element.h b/ui/base/animation/animation_container_element.h index 8ac63a5..f49eb29 100644 --- a/ui/base/animation/animation_container_element.h +++ b/ui/base/animation/animation_container_element.h @@ -7,12 +7,13 @@ #pragma once #include "base/time.h" +#include "ui/ui_api.h" namespace ui { // Interface for the elements the AnimationContainer contains. This is // implemented by Animation. -class AnimationContainerElement { +class UI_API AnimationContainerElement { public: // Sets the start of the animation. This is invoked from // AnimationContainer::Start. diff --git a/ui/base/animation/linear_animation.h b/ui/base/animation/linear_animation.h index 38205ea..7e09efb 100644 --- a/ui/base/animation/linear_animation.h +++ b/ui/base/animation/linear_animation.h @@ -15,7 +15,7 @@ class AnimationDelegate; // Linear time bounded animation. As the animation progresses AnimateToState is // invoked. -class LinearAnimation : public Animation { +class UI_API LinearAnimation : public Animation { public: // Initializes everything except the duration. // diff --git a/ui/base/animation/multi_animation.h b/ui/base/animation/multi_animation.h index fbacde3..fcd18b5 100644 --- a/ui/base/animation/multi_animation.h +++ b/ui/base/animation/multi_animation.h @@ -17,7 +17,7 @@ namespace ui { // To create a MultiAnimation pass in the parts, invoke Start() and the delegate // is notified as the animation progresses. By default MultiAnimation runs until // Stop is invoked, see |set_continuous()| for details. -class MultiAnimation : public Animation { +class UI_API MultiAnimation : public Animation { public: // Defines part of the animation. Each part consists of the following: // diff --git a/ui/base/animation/slide_animation.h b/ui/base/animation/slide_animation.h index 8f5e67c..a715f75 100644 --- a/ui/base/animation/slide_animation.h +++ b/ui/base/animation/slide_animation.h @@ -45,7 +45,7 @@ namespace ui { // private: // scoped_ptr<SlideAnimation> animation_; // } -class SlideAnimation : public LinearAnimation { +class UI_API SlideAnimation : public LinearAnimation { public: explicit SlideAnimation(AnimationDelegate* target); virtual ~SlideAnimation(); diff --git a/ui/base/animation/throb_animation.h b/ui/base/animation/throb_animation.h index 21dc03b..81b9ab4 100644 --- a/ui/base/animation/throb_animation.h +++ b/ui/base/animation/throb_animation.h @@ -17,7 +17,7 @@ namespace ui { // // A ThrobAnimation has two durations: the duration used when behavior like // a SlideAnimation, and the duration used when throbbing. -class ThrobAnimation : public SlideAnimation { +class UI_API ThrobAnimation : public SlideAnimation { public: explicit ThrobAnimation(AnimationDelegate* target); virtual ~ThrobAnimation() {} diff --git a/ui/base/animation/tween.h b/ui/base/animation/tween.h index 873281f..9681bed 100644 --- a/ui/base/animation/tween.h +++ b/ui/base/animation/tween.h @@ -7,6 +7,7 @@ #pragma once #include "base/basictypes.h" +#include "ui/ui_api.h" namespace gfx { class Rect; @@ -14,7 +15,7 @@ class Rect; namespace ui { -class Tween { +class UI_API Tween { public: enum Type { LINEAR, // Linear. diff --git a/ui/base/clipboard/clipboard.h b/ui/base/clipboard/clipboard.h index b9ae1fb..1adb5a0 100644 --- a/ui/base/clipboard/clipboard.h +++ b/ui/base/clipboard/clipboard.h @@ -14,6 +14,7 @@ #include "base/process.h" #include "base/shared_memory.h" #include "base/string16.h" +#include "ui/ui_api.h" namespace gfx { class Size; @@ -28,7 +29,7 @@ typedef struct _GtkClipboard GtkClipboard; namespace ui { -class Clipboard { +class UI_API Clipboard { public: typedef std::string FormatType; diff --git a/ui/base/clipboard/clipboard_util_win.h b/ui/base/clipboard/clipboard_util_win.h index 6c322ee..a9c33e0 100644 --- a/ui/base/clipboard/clipboard_util_win.h +++ b/ui/base/clipboard/clipboard_util_win.h @@ -12,9 +12,11 @@ #include <string> #include <vector> +#include "ui/ui_api.h" + namespace ui { -class ClipboardUtil { +class UI_API ClipboardUtil { public: ///////////////////////////////////////////////////////////////////////////// // Clipboard formats. diff --git a/ui/base/clipboard/scoped_clipboard_writer.h b/ui/base/clipboard/scoped_clipboard_writer.h index 4bd2da7..e0c296b 100644 --- a/ui/base/clipboard/scoped_clipboard_writer.h +++ b/ui/base/clipboard/scoped_clipboard_writer.h @@ -16,6 +16,7 @@ #include "base/string16.h" #include "ui/base/clipboard/clipboard.h" +#include "ui/ui_api.h" class Pickle; @@ -25,7 +26,7 @@ namespace ui { // into a Clipboard::ObjectMap. // NB: You should probably NOT be using this class if you include // webkit_glue.h. Use ScopedClipboardWriterGlue instead. -class ScopedClipboardWriter { +class UI_API ScopedClipboardWriter { public: // Create an instance that is a simple wrapper around clipboard. explicit ScopedClipboardWriter(Clipboard* clipboard); diff --git a/ui/base/dragdrop/drag_drop_types.h b/ui/base/dragdrop/drag_drop_types.h index 7cdd614..b3d3c8c 100644 --- a/ui/base/dragdrop/drag_drop_types.h +++ b/ui/base/dragdrop/drag_drop_types.h @@ -6,13 +6,12 @@ #define UI_BASE_DRAGDROP_DRAG_DROP_TYPES_H_ #pragma once -#include "build/build_config.h" - #include "base/basictypes.h" +#include "ui/ui_api.h" namespace ui { -class DragDropTypes { +class UI_API DragDropTypes { public: enum DragOperation { DRAG_NONE = 0, diff --git a/ui/base/dragdrop/drag_source.h b/ui/base/dragdrop/drag_source.h index ab67434..fb332e2 100644 --- a/ui/base/dragdrop/drag_source.h +++ b/ui/base/dragdrop/drag_source.h @@ -10,6 +10,7 @@ #include "base/basictypes.h" #include "base/memory/ref_counted.h" +#include "ui/ui_api.h" namespace ui { @@ -17,8 +18,8 @@ namespace ui { // drag-drop operation as the user mouses over other drop targets on their // system. This object tells Windows whether or not the drag should continue, // and supplies the appropriate cursors. -class DragSource : public IDropSource, - public base::RefCountedThreadSafe<DragSource> { +class UI_API DragSource : public IDropSource, + public base::RefCountedThreadSafe<DragSource> { public: DragSource(); virtual ~DragSource() {} diff --git a/ui/base/dragdrop/drop_target.h b/ui/base/dragdrop/drop_target.h index 9b8903a..53d88fa 100644 --- a/ui/base/dragdrop/drop_target.h +++ b/ui/base/dragdrop/drop_target.h @@ -9,6 +9,7 @@ #include <objidl.h> #include "base/memory/ref_counted.h" +#include "ui/ui_api.h" // Windows interface. struct IDropTargetHelper; @@ -24,7 +25,7 @@ namespace ui { // before the HWND is deleted too. // // This class is meant to be used in a STA and is not multithread-safe. -class DropTarget : public IDropTarget { +class UI_API DropTarget : public IDropTarget { public: // Create a new DropTarget associating it with the given HWND. explicit DropTarget(HWND hwnd); diff --git a/ui/base/dragdrop/gtk_dnd_util.h b/ui/base/dragdrop/gtk_dnd_util.h index 5a0adde..ab3322e 100644 --- a/ui/base/dragdrop/gtk_dnd_util.h +++ b/ui/base/dragdrop/gtk_dnd_util.h @@ -11,6 +11,7 @@ #include <vector> #include "base/string16.h" +#include "ui/ui_api.h" class GURL; @@ -42,7 +43,7 @@ enum { // Get the atom for a given target (of the above enum type). Will return NULL // for non-custom targets, such as CHROME_TEXT_PLAIN. -GdkAtom GetAtomForTarget(int target); +UI_API GdkAtom GetAtomForTarget(int target); // Creates a target list from the given mask. The mask should be an OR of // CHROME_* values. The target list is returned with ref count 1; the caller @@ -51,18 +52,18 @@ GdkAtom GetAtomForTarget(int target); // Since the MIME type for WEBDROP_FILE_CONTENTS depends on the file's // contents, that flag is ignored by this function. It is the responsibility // of the client code to do the right thing. -GtkTargetList* GetTargetListFromCodeMask(int code_mask); +UI_API GtkTargetList* GetTargetListFromCodeMask(int code_mask); // Set the drag target list for |source| with the target list that // corresponds to |code_mask|. -void SetSourceTargetListFromCodeMask(GtkWidget* source, int code_mask); +UI_API void SetSourceTargetListFromCodeMask(GtkWidget* source, int code_mask); // Set the accepted targets list for |dest|. The |target_codes| array should // be sorted in preference order and should be terminated with -1. -void SetDestTargetList(GtkWidget* dest, const int* target_codes); +UI_API void SetDestTargetList(GtkWidget* dest, const int* target_codes); // Write a URL to the selection in the given type. -void WriteURLWithName(GtkSelectionData* selection_data, +UI_API void WriteURLWithName(GtkSelectionData* selection_data, const GURL& url, string16 title, int type); @@ -70,18 +71,18 @@ void WriteURLWithName(GtkSelectionData* selection_data, // Extracts data of type CHROME_NAMED_URL from |selection_data| into // |url| and |title|. Returns true if the url/title were safely extracted // and the url is valid. -bool ExtractNamedURL(GtkSelectionData* selection_data, - GURL* url, - string16* title); +UI_API bool ExtractNamedURL(GtkSelectionData* selection_data, + GURL* url, + string16* title); // Extracts data of type TEXT_URI_LIST from |selection_data| into |urls|. -bool ExtractURIList(GtkSelectionData* selection_data, - std::vector<GURL>* urls); +UI_API bool ExtractURIList(GtkSelectionData* selection_data, + std::vector<GURL>* urls); // Extracts a Netscape URL (url\ntitle) from |selection_data|. -bool ExtractNetscapeURL(GtkSelectionData* selection_data, - GURL* url, - string16* title); +UI_API bool ExtractNetscapeURL(GtkSelectionData* selection_data, + GURL* url, + string16* title); } // namespace ui diff --git a/ui/base/dragdrop/os_exchange_data.h b/ui/base/dragdrop/os_exchange_data.h index 05bb881..085048d 100644 --- a/ui/base/dragdrop/os_exchange_data.h +++ b/ui/base/dragdrop/os_exchange_data.h @@ -21,6 +21,7 @@ #include "base/file_path.h" #include "base/memory/scoped_ptr.h" #include "ui/base/dragdrop/download_file_interface.h" +#include "ui/ui_api.h" class GURL; class Pickle; @@ -41,7 +42,7 @@ namespace ui { // TabContentsViewGtk uses a different class to handle drag support that does // not use OSExchangeData. As such, file contents and html support is only // compiled on windows. -class OSExchangeData { +class UI_API OSExchangeData { public: // CustomFormats are used for non-standard data types. For example, bookmark // nodes are written using a CustomFormat. @@ -64,7 +65,7 @@ class OSExchangeData { }; // Encapsulates the info about a file to be downloaded. - struct DownloadFileInfo { + struct UI_API DownloadFileInfo { DownloadFileInfo(const FilePath& filename, DownloadFileProvider* downloader); ~DownloadFileInfo(); @@ -75,7 +76,7 @@ class OSExchangeData { // Provider defines the platform specific part of OSExchangeData that // interacts with the native system. - class Provider { + class UI_API Provider { public: Provider() {} virtual ~Provider() {} diff --git a/ui/base/dragdrop/os_exchange_data_provider_win.h b/ui/base/dragdrop/os_exchange_data_provider_win.h index ba92197..3e150da 100644 --- a/ui/base/dragdrop/os_exchange_data_provider_win.h +++ b/ui/base/dragdrop/os_exchange_data_provider_win.h @@ -11,6 +11,7 @@ #include <string> #include "base/win/scoped_comptr.h" +#include "ui/ui_api.h" #include "ui/base/dragdrop/os_exchange_data.h" namespace ui { @@ -126,7 +127,7 @@ class DataObjectImpl : public DownloadFileObserver, Observer* observer_; }; -class OSExchangeDataProviderWin : public OSExchangeData::Provider { +class UI_API OSExchangeDataProviderWin : public OSExchangeData::Provider { public: // Returns true if source has plain text that is a valid url. static bool HasPlainTextURL(IDataObject* source); diff --git a/ui/base/gtk/event_synthesis_gtk.h b/ui/base/gtk/event_synthesis_gtk.h index 9ffdf40..da1257c 100644 --- a/ui/base/gtk/event_synthesis_gtk.h +++ b/ui/base/gtk/event_synthesis_gtk.h @@ -15,6 +15,7 @@ #include <vector> #include "ui/base/keycodes/keyboard_codes.h" +#include "ui/ui_api.h" namespace ui { @@ -26,7 +27,7 @@ GdkEvent* SynthesizeKeyEvent(GdkWindow* event_window, // Creates the proper sequence of key events for a key press + release. // Ownership of the events in the vector is passed to the caller. -void SynthesizeKeyPressEvents( +UI_API void SynthesizeKeyPressEvents( GdkWindow* window, KeyboardCode key, bool control, bool shift, bool alt, diff --git a/ui/base/gtk/gtk_im_context_util.h b/ui/base/gtk/gtk_im_context_util.h index dd560a9..0cd23db 100644 --- a/ui/base/gtk/gtk_im_context_util.h +++ b/ui/base/gtk/gtk_im_context_util.h @@ -8,16 +8,18 @@ #include <pango/pango-attributes.h> +#include "ui/ui_api.h" + namespace ui { struct CompositionText; // Extracts composition text information (text, underlines, selection range) // from given Gtk preedit data (utf-8 text, pango attributes, cursor position). -void ExtractCompositionTextFromGtkPreedit(const gchar* utf8_text, - PangoAttrList* attrs, - int cursor_position, - CompositionText* composition); +UI_API void ExtractCompositionTextFromGtkPreedit(const gchar* utf8_text, + PangoAttrList* attrs, + int cursor_position, + CompositionText* composition); } // namespace ui diff --git a/ui/base/gtk/gtk_signal_registrar.h b/ui/base/gtk/gtk_signal_registrar.h index b7e4e2f..3c4e0e8 100644 --- a/ui/base/gtk/gtk_signal_registrar.h +++ b/ui/base/gtk/gtk_signal_registrar.h @@ -11,6 +11,7 @@ #include <vector> #include "base/basictypes.h" +#include "ui/ui_api.h" typedef void (*GCallback) (void); typedef struct _GObject GObject; @@ -37,7 +38,7 @@ namespace ui { // // When |signals_| goes down, it will disconnect the handlers connected via // Connect. -class GtkSignalRegistrar { +class UI_API GtkSignalRegistrar { public: GtkSignalRegistrar(); ~GtkSignalRegistrar(); diff --git a/ui/base/gtk/gtk_windowing.h b/ui/base/gtk/gtk_windowing.h index d94520f..85696e3 100644 --- a/ui/base/gtk/gtk_windowing.h +++ b/ui/base/gtk/gtk_windowing.h @@ -7,10 +7,12 @@ #include <gtk/gtk.h> +#include "ui/ui_api.h" + namespace ui { // Stacks a |popup| window directly on top of a |toplevel| window. -void StackPopupWindow(GtkWidget* popup, GtkWidget* toplevel); +UI_API void StackPopupWindow(GtkWidget* popup, GtkWidget* toplevel); } // namespace ui diff --git a/ui/base/ime/composition_text.h b/ui/base/ime/composition_text.h index 2014e50..f2b0821 100644 --- a/ui/base/ime/composition_text.h +++ b/ui/base/ime/composition_text.h @@ -9,11 +9,12 @@ #include "base/string16.h" #include "ui/base/ime/composition_underline.h" #include "ui/base/range/range.h" +#include "ui/ui_api.h" namespace ui { // A struct represents the status of an ongoing composition text. -struct CompositionText { +struct UI_API CompositionText { CompositionText(); ~CompositionText(); diff --git a/ui/base/keycodes/keyboard_code_conversion_gtk.h b/ui/base/keycodes/keyboard_code_conversion_gtk.h index 3221da5..d0fcfb6 100644 --- a/ui/base/keycodes/keyboard_code_conversion_gtk.h +++ b/ui/base/keycodes/keyboard_code_conversion_gtk.h @@ -38,14 +38,15 @@ #pragma once #include "ui/base/keycodes/keyboard_codes_posix.h" +#include "ui/ui_api.h" typedef struct _GdkEventKey GdkEventKey; namespace ui { -KeyboardCode WindowsKeyCodeForGdkKeyCode(int keycode); +UI_API KeyboardCode WindowsKeyCodeForGdkKeyCode(int keycode); -int GdkKeyCodeForWindowsKeyCode(KeyboardCode keycode, bool shift); +UI_API int GdkKeyCodeForWindowsKeyCode(KeyboardCode keycode, bool shift); KeyboardCode KeyboardCodeFromGdkEventKey(GdkEventKey* event); diff --git a/ui/base/keycodes/keyboard_code_conversion_win.h b/ui/base/keycodes/keyboard_code_conversion_win.h index 98310a1..a43d09f 100644 --- a/ui/base/keycodes/keyboard_code_conversion_win.h +++ b/ui/base/keycodes/keyboard_code_conversion_win.h @@ -7,12 +7,13 @@ #pragma once #include "ui/base/keycodes/keyboard_codes.h" +#include "ui/ui_api.h" namespace ui { // Methods to convert ui::KeyboardCode/Windows virtual key type methods. -WORD WindowsKeyCodeForKeyboardCode(KeyboardCode keycode); -KeyboardCode KeyboardCodeForWindowsKeyCode(WORD keycode); +UI_API WORD WindowsKeyCodeForKeyboardCode(KeyboardCode keycode); +UI_API KeyboardCode KeyboardCodeForWindowsKeyCode(WORD keycode); } // namespace ui diff --git a/ui/base/l10n/l10n_font_util.h b/ui/base/l10n/l10n_font_util.h index 329b96d..4478569 100644 --- a/ui/base/l10n/l10n_font_util.h +++ b/ui/base/l10n/l10n_font_util.h @@ -7,6 +7,7 @@ #pragma once #include "ui/gfx/size.h" +#include "ui/ui_api.h" namespace gfx { class Font; @@ -18,13 +19,13 @@ namespace ui { // its localized size data and the given font. The width in cols is held in a // localized string resource identified by |col_resource_id|, the height in the // same fashion. -int GetLocalizedContentsWidthForFont(int col_resource_id, - const gfx::Font& font); -int GetLocalizedContentsHeightForFont(int row_resource_id, - const gfx::Font& font); -gfx::Size GetLocalizedContentsSizeForFont(int col_resource_id, - int row_resource_id, - const gfx::Font& font); +UI_API int GetLocalizedContentsWidthForFont(int col_resource_id, + const gfx::Font& font); +UI_API int GetLocalizedContentsHeightForFont(int row_resource_id, + const gfx::Font& font); +UI_API gfx::Size GetLocalizedContentsSizeForFont(int col_resource_id, + int row_resource_id, + const gfx::Font& font); } // namespace ui diff --git a/ui/base/l10n/l10n_util.h b/ui/base/l10n/l10n_util.h index 4eca6fc..8c7cabc 100644 --- a/ui/base/l10n/l10n_util.h +++ b/ui/base/l10n/l10n_util.h @@ -14,6 +14,7 @@ #include "base/string16.h" #include "base/string_util.h" +#include "ui/ui_api.h" #if defined(OS_MACOSX) #include "ui/base/l10n/l10n_util_mac.h" @@ -30,7 +31,7 @@ namespace l10n_util { // as |pref_locale|), finally, we fall back on the system locale. We only return // a value if there's a corresponding resource DLL for the locale. Otherwise, // we fall back to en-us. -std::string GetApplicationLocale(const std::string& pref_locale); +UI_API std::string GetApplicationLocale(const std::string& pref_locale); // Given a locale code, return true if the OS is capable of supporting it. // For instance, Oriya is not well supported on Windows XP and we return @@ -46,18 +47,18 @@ bool IsLocaleSupportedByOS(const std::string& locale); // in the UI thread. // If |is_for_ui| is true, U+200F is appended so that it can be // rendered properly in a RTL Chrome. -string16 GetDisplayNameForLocale(const std::string& locale, - const std::string& display_locale, - bool is_for_ui); +UI_API string16 GetDisplayNameForLocale(const std::string& locale, + const std::string& display_locale, + bool is_for_ui); // Converts all - into _, to be consistent with ICU and file system names. -std::string NormalizeLocale(const std::string& locale); +UI_API std::string NormalizeLocale(const std::string& locale); // Produce a vector of parent locales for given locale. // It includes the current locale in the result. // sr_Cyrl_RS generates sr_Cyrl_RS, sr_Cyrl and sr. -void GetParentLocales(const std::string& current_locale, - std::vector<std::string>* parent_locales); +UI_API void GetParentLocales(const std::string& current_locale, + std::vector<std::string>* parent_locales); // Checks if a string is plausibly a syntactically-valid locale string, // for cases where we want the valid input to be a locale string such as @@ -67,67 +68,67 @@ void GetParentLocales(const std::string& current_locale, // accepted, but 'z', 'German', 'en-$1', or 'abcd-1234' should not. // Case-insensitive. Based on BCP 47, see: // http://unicode.org/reports/tr35/#Unicode_Language_and_Locale_Identifiers -bool IsValidLocaleSyntax(const std::string& locale); +UI_API bool IsValidLocaleSyntax(const std::string& locale); // // Mac Note: See l10n_util_mac.h for some NSString versions and other support. // // Pulls resource string from the string bundle and returns it. -std::string GetStringUTF8(int message_id); -string16 GetStringUTF16(int message_id); +UI_API std::string GetStringUTF8(int message_id); +UI_API string16 GetStringUTF16(int message_id); // Get a resource string and replace $1-$2-$3 with |a| and |b| // respectively. Additionally, $$ is replaced by $. -string16 GetStringFUTF16(int message_id, - const string16& a); -string16 GetStringFUTF16(int message_id, - const string16& a, - const string16& b); -string16 GetStringFUTF16(int message_id, - const string16& a, - const string16& b, - const string16& c); -string16 GetStringFUTF16(int message_id, - const string16& a, - const string16& b, - const string16& c, - const string16& d); -string16 GetStringFUTF16(int message_id, - const string16& a, - const string16& b, - const string16& c, - const string16& d, - const string16& e); -std::string GetStringFUTF8(int message_id, - const string16& a); -std::string GetStringFUTF8(int message_id, - const string16& a, - const string16& b); -std::string GetStringFUTF8(int message_id, - const string16& a, - const string16& b, - const string16& c); -std::string GetStringFUTF8(int message_id, - const string16& a, - const string16& b, - const string16& c, - const string16& d); +UI_API string16 GetStringFUTF16(int message_id, + const string16& a); +UI_API string16 GetStringFUTF16(int message_id, + const string16& a, + const string16& b); +UI_API string16 GetStringFUTF16(int message_id, + const string16& a, + const string16& b, + const string16& c); +UI_API string16 GetStringFUTF16(int message_id, + const string16& a, + const string16& b, + const string16& c, + const string16& d); +UI_API string16 GetStringFUTF16(int message_id, + const string16& a, + const string16& b, + const string16& c, + const string16& d, + const string16& e); +UI_API std::string GetStringFUTF8(int message_id, + const string16& a); +UI_API std::string GetStringFUTF8(int message_id, + const string16& a, + const string16& b); +UI_API std::string GetStringFUTF8(int message_id, + const string16& a, + const string16& b, + const string16& c); +UI_API std::string GetStringFUTF8(int message_id, + const string16& a, + const string16& b, + const string16& c, + const string16& d); // Variants that return the offset(s) of the replaced parameters. The // vector based version returns offsets ordered by parameter. For example if // invoked with a and b offsets[0] gives the offset for a and offsets[1] the // offset of b regardless of where the parameters end up in the string. -string16 GetStringFUTF16(int message_id, - const string16& a, - size_t* offset); -string16 GetStringFUTF16(int message_id, - const string16& a, - const string16& b, - std::vector<size_t>* offsets); +UI_API string16 GetStringFUTF16(int message_id, + const string16& a, + size_t* offset); +UI_API string16 GetStringFUTF16(int message_id, + const string16& a, + const string16& b, + std::vector<size_t>* offsets); // Convenience functions to get a string with a single number as a parameter. -string16 GetStringFUTF16Int(int message_id, int a); +UI_API string16 GetStringFUTF16Int(int message_id, int a); string16 GetStringFUTF16Int(int message_id, int64 a); // Truncates the string to length characters. This breaks the string at @@ -135,19 +136,20 @@ string16 GetStringFUTF16Int(int message_id, int64 a); // character (unicode character 0x2026) to render ... // The supplied string is returned if the string has length characters or // less. -string16 TruncateString(const string16& string, size_t length); +UI_API string16 TruncateString(const string16& string, size_t length); // In place sorting of string16 strings using collation rules for |locale|. -void SortStrings16(const std::string& locale, - std::vector<string16>* strings); +UI_API void SortStrings16(const std::string& locale, + std::vector<string16>* strings); // Returns a vector of available locale codes. E.g., a vector containing // en-US, es, fr, fi, pt-PT, pt-BR, etc. -const std::vector<std::string>& GetAvailableLocales(); +UI_API const std::vector<std::string>& GetAvailableLocales(); // Returns a vector of locale codes usable for accept-languages. -void GetAcceptLanguagesForLocale(const std::string& display_locale, - std::vector<std::string>* locale_codes); +UI_API void GetAcceptLanguagesForLocale( + const std::string& display_locale, + std::vector<std::string>* locale_codes); } // namespace l10n_util diff --git a/ui/base/l10n/l10n_util_collator.h b/ui/base/l10n/l10n_util_collator.h index 8610ca2..11afe78 100644 --- a/ui/base/l10n/l10n_util_collator.h +++ b/ui/base/l10n/l10n_util_collator.h @@ -13,14 +13,16 @@ #include "base/memory/scoped_ptr.h" #include "base/utf_string_conversions.h" +#include "ui/ui_api.h" #include "unicode/coll.h" namespace l10n_util { // Compares the two strings using the specified collator. -UCollationResult CompareString16WithCollator(const icu::Collator* collator, - const string16& lhs, - const string16& rhs); +UI_API UCollationResult CompareString16WithCollator( + const icu::Collator* collator, + const string16& lhs, + const string16& rhs); // Used by SortStringsUsingMethod. Invokes a method on the objects passed to // operator (), comparing the string results using a collator. @@ -110,7 +112,7 @@ class StringComparator : public std::binary_function<const Element&, }; // Specialization of operator() method for string16 version. -template <> +template <> UI_API bool StringComparator<string16>::operator()(const string16& lhs, const string16& rhs); diff --git a/ui/base/l10n/l10n_util_win.h b/ui/base/l10n/l10n_util_win.h index 52a4ecc..7e61719 100644 --- a/ui/base/l10n/l10n_util_win.h +++ b/ui/base/l10n/l10n_util_win.h @@ -10,6 +10,8 @@ #include <string> #include <vector> +#include "ui/ui_api.h" + namespace l10n_util { // Returns the locale-dependent extended window styles. @@ -17,17 +19,17 @@ namespace l10n_util { // (e.g. WS_EX_LAYOUTRTL, WS_EX_RTLREADING, etc.) when creating a window. // Callers should OR this value into their extended style value when creating // a window. -int GetExtendedStyles(); +UI_API int GetExtendedStyles(); // TODO(xji): // This is a temporary name, it will eventually replace GetExtendedStyles -int GetExtendedTooltipStyles(); +UI_API int GetExtendedTooltipStyles(); // Give an HWND, this function sets the WS_EX_LAYOUTRTL extended style for the // underlying window. When this style is set, the UI for the window is going to // be mirrored. This is generally done for the UI of right-to-left languages // such as Hebrew. -void HWNDSetRTLLayout(HWND hwnd); +UI_API void HWNDSetRTLLayout(HWND hwnd); // See http://blogs.msdn.com/oldnewthing/archive/2005/09/15/467598.aspx // and http://blogs.msdn.com/oldnewthing/archive/2006/06/26/647365.aspx @@ -37,22 +39,22 @@ void HWNDSetRTLLayout(HWND hwnd); // to use in the UI of the current UI (e.g. Malayalam, Bengali). If // override_font_family and font_size_scaler are not null, they'll be // filled with the font family name and the size scaler. -bool NeedOverrideDefaultUIFont(std::wstring* override_font_family, - double* font_size_scaler); +UI_API bool NeedOverrideDefaultUIFont(std::wstring* override_font_family, + double* font_size_scaler); // If the default UI font stored in |logfont| is not suitable, its family // and size are replaced with those stored in the per-locale resource. -void AdjustUIFont(LOGFONT* logfont); +UI_API void AdjustUIFont(LOGFONT* logfont); // If the font for a given window (pointed to by HWND) is not suitable for the // UI in the current UI langauge, its family and size are replaced with those // stored in the per-locale resource. -void AdjustUIFontForWindow(HWND hwnd); +UI_API void AdjustUIFontForWindow(HWND hwnd); // Allow processes to override the configured locale with the user's Windows UI // languages. This function should generally be called once early in // Application startup. -void OverrideLocaleWithUILanguageList(); +UI_API void OverrideLocaleWithUILanguageList(); // Retrieve the locale override, or an empty vector if the locale has not been // or failed to be overridden. diff --git a/ui/base/message_box_win.h b/ui/base/message_box_win.h index f9011e6..9d777c5 100644 --- a/ui/base/message_box_win.h +++ b/ui/base/message_box_win.h @@ -9,6 +9,7 @@ #include <windows.h> #include "base/string16.h" +#include "ui/ui_api.h" namespace ui { @@ -16,10 +17,10 @@ namespace ui { // MessageBox function allows us to control certain RTL locale flags so that // callers don't have to worry about adding these flags when running in a // right-to-left locale. -int MessageBox(HWND hwnd, - const string16& text, - const string16& caption, - UINT flags); +UI_API int MessageBox(HWND hwnd, + const string16& text, + const string16& caption, + UINT flags); } // namespace ui diff --git a/ui/base/models/button_menu_item_model.h b/ui/base/models/button_menu_item_model.h index 7c83e5e..7e5d198 100644 --- a/ui/base/models/button_menu_item_model.h +++ b/ui/base/models/button_menu_item_model.h @@ -9,12 +9,13 @@ #include <vector> #include "base/string16.h" +#include "ui/ui_api.h" namespace ui { // A model representing the rows of buttons that should be inserted in a button // containing menu item. -class ButtonMenuItemModel { +class UI_API ButtonMenuItemModel { public: // Types of buttons. enum ButtonType { @@ -23,7 +24,7 @@ class ButtonMenuItemModel { TYPE_BUTTON_LABEL }; - class Delegate { + class UI_API Delegate { public: // Some command ids have labels that change over time. virtual bool IsItemForCommandIdDynamic(int command_id) const; diff --git a/ui/base/models/menu_model.h b/ui/base/models/menu_model.h index a0c3627..b4419fc 100644 --- a/ui/base/models/menu_model.h +++ b/ui/base/models/menu_model.h @@ -10,6 +10,7 @@ #include "base/string16.h" #include "ui/base/models/menu_model_delegate.h" #include "ui/gfx/native_widget_types.h" +#include "ui/ui_api.h" class SkBitmap; @@ -23,7 +24,7 @@ class Accelerator; class ButtonMenuItemModel; // An interface implemented by an object that provides the content of a menu. -class MenuModel { +class UI_API MenuModel { public: // The type of item. enum ItemType { diff --git a/ui/base/models/simple_menu_model.h b/ui/base/models/simple_menu_model.h index e8ccb40..de233fd 100644 --- a/ui/base/models/simple_menu_model.h +++ b/ui/base/models/simple_menu_model.h @@ -20,9 +20,9 @@ class ButtonMenuItemModel; // items. This makes it easy to construct fixed menus. Menus populated by // dynamic data sources may be better off implementing MenuModel directly. // The breadth of MenuModel is not exposed through this API. -class SimpleMenuModel : public MenuModel { +class UI_API SimpleMenuModel : public MenuModel { public: - class Delegate { + class UI_API Delegate { public: // Methods for determining the state of specific command ids. virtual bool IsCommandIdChecked(int command_id) const = 0; diff --git a/ui/base/models/table_model.h b/ui/base/models/table_model.h index b9f02c2..968edf1 100644 --- a/ui/base/models/table_model.h +++ b/ui/base/models/table_model.h @@ -9,6 +9,7 @@ #include <vector> #include "base/string16.h" +#include "ui/ui_api.h" #include "unicode/coll.h" class SkBitmap; @@ -18,7 +19,7 @@ namespace ui { class TableModelObserver; // The model driving the TableView. -class TableModel { +class UI_API TableModel { public: // See HasGroups, get GetGroupID for details as to how this is used. struct Group { @@ -89,7 +90,7 @@ class TableModel { }; // TableColumn specifies the title, alignment and size of a particular column. -struct TableColumn { +struct UI_API TableColumn { enum Alignment { LEFT, RIGHT, CENTER }; diff --git a/ui/base/models/tree_model.h b/ui/base/models/tree_model.h index 190115b..56b1bff 100644 --- a/ui/base/models/tree_model.h +++ b/ui/base/models/tree_model.h @@ -9,6 +9,7 @@ #include <vector> #include "base/string16.h" +#include "ui/ui_api.h" class SkBitmap; @@ -53,7 +54,7 @@ class TreeModelObserver { // TreeModel ------------------------------------------------------------------ // The model for TreeView. -class TreeModel { +class UI_API TreeModel { public: // Returns the root of the tree. This may or may not be shown in the tree, // see SetRootShown for details. diff --git a/ui/base/range/range.h b/ui/base/range/range.h index c1ddaf5..df899e5 100644 --- a/ui/base/range/range.h +++ b/ui/base/range/range.h @@ -8,6 +8,7 @@ #include <iosfwd> #include "base/basictypes.h" +#include "ui/ui_api.h" #if defined(OS_MACOSX) #if __OBJC__ @@ -29,7 +30,7 @@ namespace ui { // position; when they are the same, the Range is akin to a caret. Note that // |start_| can be greater than |end_| to respect the directionality of the // range. -class Range { +class UI_API Range { public: // Creates an empty range {0,0}. Range(); @@ -105,7 +106,7 @@ class Range { size_t end_; }; -std::ostream& operator<<(std::ostream& out, const ui::Range& range); +UI_API std::ostream& operator<<(std::ostream& out, const ui::Range& range); } // namespace gfx diff --git a/ui/base/resource/data_pack.h b/ui/base/resource/data_pack.h index fb5f79b..001ed0e 100644 --- a/ui/base/resource/data_pack.h +++ b/ui/base/resource/data_pack.h @@ -14,6 +14,7 @@ #include "base/basictypes.h" #include "base/memory/scoped_ptr.h" +#include "ui/ui_api.h" class FilePath; class RefCountedStaticMemory; @@ -28,7 +29,7 @@ class MemoryMappedFile; namespace ui { -class DataPack { +class UI_API DataPack { public: DataPack(); ~DataPack(); diff --git a/ui/base/resource/resource_bundle.cc b/ui/base/resource/resource_bundle.cc index 848821c..04a2cf3 100644 --- a/ui/base/resource/resource_bundle.cc +++ b/ui/base/resource/resource_bundle.cc @@ -117,6 +117,7 @@ gfx::Image& ResourceBundle::GetImageNamed(int resource_id) { return *found->second; } + DCHECK(resources_data_) << "Missing call to SetResourcesDataDLL?"; scoped_ptr<SkBitmap> bitmap(LoadBitmap(resources_data_, resource_id)); if (bitmap.get()) { // Check if there's a large version of the image as well. diff --git a/ui/base/resource/resource_bundle.h b/ui/base/resource/resource_bundle.h index 8fc8866..692a3aa 100644 --- a/ui/base/resource/resource_bundle.h +++ b/ui/base/resource/resource_bundle.h @@ -23,6 +23,7 @@ #include "base/memory/scoped_ptr.h" #include "base/string16.h" #include "ui/gfx/native_widget_types.h" +#include "ui/ui_api.h" class SkBitmap; typedef uint32 SkColor; @@ -56,7 +57,7 @@ class DataPack; // ResourceBundle is a central facility to load images and other resources, // such as theme graphics. // Every resource is loaded only once. -class ResourceBundle { +class UI_API ResourceBundle { public: // An enumeration of the various font styles used throughout Chrome. // The following holds true for the font sizes: @@ -142,6 +143,10 @@ class ResourceBundle { void ReloadFonts(); #if defined(OS_WIN) + // NOTE: This needs to be called before initializing the shared instance if + // your resources are not stored in the executable. + static void SetResourcesDataDLL(HINSTANCE handle); + // Loads and returns an icon from the app module. HICON LoadThemeIcon(int icon_id); diff --git a/ui/base/resource/resource_bundle_dummy.cc b/ui/base/resource/resource_bundle_dummy.cc index 0dbf1f1..8a2ad08 100644 --- a/ui/base/resource/resource_bundle_dummy.cc +++ b/ui/base/resource/resource_bundle_dummy.cc @@ -57,4 +57,8 @@ string16 ResourceBundle::GetLocalizedString(int message_id) { return string16(); } +// static +void ResourceBundle::SetResourcesDataDLL(HINSTANCE handle) { +} + } // namespace ui diff --git a/ui/base/resource/resource_bundle_win.cc b/ui/base/resource/resource_bundle_win.cc index c459026..5f24adc 100644 --- a/ui/base/resource/resource_bundle_win.cc +++ b/ui/base/resource/resource_bundle_win.cc @@ -24,6 +24,8 @@ namespace ui { namespace { +HINSTANCE resources_data_dll; + // Returns the flags that should be passed to LoadLibraryEx. DWORD GetDataDllLoadFlags() { if (base::win::GetVersion() >= base::win::VERSION_VISTA) @@ -45,7 +47,12 @@ ResourceBundle::~ResourceBundle() { void ResourceBundle::LoadCommonResources() { // As a convenience, set resources_data_ to the current resource module. DCHECK(NULL == resources_data_) << "common resources already loaded"; - resources_data_ = _AtlBaseModule.GetResourceInstance(); + + if (resources_data_dll) { + resources_data_ = resources_data_dll; + } else { + resources_data_ = GetModuleHandle(NULL); + } } std::string ResourceBundle::LoadLocaleResources( @@ -106,6 +113,11 @@ RefCountedStaticMemory* ResourceBundle::LoadResourceBytes( } } +// static +void ResourceBundle::SetResourcesDataDLL(HINSTANCE handle) { + resources_data_dll = handle; +} + HICON ResourceBundle::LoadThemeIcon(int icon_id) { return ::LoadIcon(resources_data_, MAKEINTRESOURCE(icon_id)); } @@ -113,7 +125,7 @@ HICON ResourceBundle::LoadThemeIcon(int icon_id) { base::StringPiece ResourceBundle::GetRawDataResource(int resource_id) const { void* data_ptr; size_t data_size; - if (base::GetDataResourceFromModule(_AtlBaseModule.GetModuleInstance(), + if (base::GetDataResourceFromModule(resources_data_, resource_id, &data_ptr, &data_size)) { @@ -137,8 +149,7 @@ base::StringPiece ResourceBundle::GetRawDataResource(int resource_id) const { // Loads and returns a cursor from the current module. HCURSOR ResourceBundle::LoadCursor(int cursor_id) { - return ::LoadCursor(_AtlBaseModule.GetModuleInstance(), - MAKEINTRESOURCE(cursor_id)); + return ::LoadCursor(resources_data_, MAKEINTRESOURCE(cursor_id)); } string16 ResourceBundle::GetLocalizedString(int message_id) { @@ -159,8 +170,7 @@ string16 ResourceBundle::GetLocalizedString(int message_id) { if (!image) { // Fall back on the current module (shouldn't be any strings here except // in unittests). - image = AtlGetStringResourceImage(_AtlBaseModule.GetModuleInstance(), - message_id); + image = AtlGetStringResourceImage(resources_data_, message_id); if (!image) { // See http://crbug.com/21925. base::debug::StackTrace().PrintBacktrace(); diff --git a/ui/base/text/bytes_formatting.h b/ui/base/text/bytes_formatting.h index aef8f01..7e5d336 100644 --- a/ui/base/text/bytes_formatting.h +++ b/ui/base/text/bytes_formatting.h @@ -8,6 +8,7 @@ #include "base/basictypes.h" #include "base/string16.h" +#include "ui/ui_api.h" namespace ui { @@ -16,12 +17,12 @@ namespace ui { // Simple call to return a byte quantity as a string in human-readable format. // Ex: FormatBytes(512) => "512 B" // Ex: FormatBytes(101479) => "99.1 kB" -string16 FormatBytes(int64 bytes); +UI_API string16 FormatBytes(int64 bytes); // Simple call to return a speed as a string in human-readable format. // Ex: FormatSpeed(512) => "512 B/s" // Ex: FormatSpeed(101479) => "99.1 kB/s" -string16 FormatSpeed(int64 bytes); +UI_API string16 FormatSpeed(int64 bytes); // Less-Simple API ------------------------------------------------------------- @@ -37,13 +38,14 @@ enum DataUnits { // Return the unit type that is appropriate for displaying the amount of bytes // passed in. Most of the time, an explicit call to this isn't necessary; just // use FormatBytes()/FormatSpeed() above. -DataUnits GetByteDisplayUnits(int64 bytes); +UI_API DataUnits GetByteDisplayUnits(int64 bytes); // Return a byte quantity as a string in human-readable format with an optional // unit suffix. Specify in the |units| argument the units to be used. // Ex: FormatBytes(512, DATA_UNITS_KIBIBYTE, true) => "0.5 kB" // Ex: FormatBytes(10*1024, DATA_UNITS_MEBIBYTE, false) => "0.1" -string16 FormatBytesWithUnits(int64 bytes, DataUnits units, bool show_units); +UI_API string16 FormatBytesWithUnits(int64 bytes, DataUnits units, + bool show_units); // As above, but with "/s" units for speed values. // Ex: FormatSpeed(512, DATA_UNITS_KIBIBYTE, true) => "0.5 kB/s" diff --git a/ui/base/text/text_elider.h b/ui/base/text/text_elider.h index 5dd3dc5..c87011f 100644 --- a/ui/base/text/text_elider.h +++ b/ui/base/text/text_elider.h @@ -12,13 +12,14 @@ #include "base/basictypes.h" #include "base/string16.h" #include "ui/gfx/font.h" +#include "ui/ui_api.h" class FilePath; class GURL; namespace ui { -extern const char kEllipsis[]; +UI_API extern const char kEllipsis[]; // This function takes a GURL object and elides it. It returns a string // which composed of parts from subdomain, domain, path, filename and query. @@ -33,18 +34,18 @@ extern const char kEllipsis[]; // as an LTR string (using base::i18n::WrapStringWithLTRFormatting()) so that it // is displayed properly in an RTL context. Please refer to // http://crbug.com/6487 for more information. -string16 ElideUrl(const GURL& url, - const gfx::Font& font, - int available_pixel_width, - const std::string& languages); +UI_API string16 ElideUrl(const GURL& url, + const gfx::Font& font, + int available_pixel_width, + const std::string& languages); // Elides |text| to fit in |available_pixel_width|. If |elide_in_middle| is // set the ellipsis is placed in the middle of the string; otherwise it is // placed at the end. -string16 ElideText(const string16& text, - const gfx::Font& font, - int available_pixel_width, - bool elide_in_middle); +UI_API string16 ElideText(const string16& text, + const gfx::Font& font, + int available_pixel_width, + bool elide_in_middle); // Elide a filename to fit a given pixel width, with an emphasis on not hiding // the extension unless we have to. If filename contains a path, the path will @@ -52,16 +53,16 @@ string16 ElideText(const string16& text, // filename is forced to have LTR directionality, which means that in RTL UI // the elided filename is wrapped with LRE (Left-To-Right Embedding) mark and // PDF (Pop Directional Formatting) mark. -string16 ElideFilename(const FilePath& filename, - const gfx::Font& font, - int available_pixel_width); +UI_API string16 ElideFilename(const FilePath& filename, + const gfx::Font& font, + int available_pixel_width); // SortedDisplayURL maintains a string from a URL suitable for display to the // use. SortedDisplayURL also provides a function used for comparing two // SortedDisplayURLs for use in visually ordering the SortedDisplayURLs. // // SortedDisplayURL is relatively cheap and supports value semantics. -class SortedDisplayURL { +class UI_API SortedDisplayURL { public: SortedDisplayURL(const GURL& url, const std::string& languages); SortedDisplayURL(); @@ -102,7 +103,8 @@ class SortedDisplayURL { // puts "Hell...Tom" in str and returns true. // TODO(tsepez): Doesn't handle UTF-16 surrogate pairs properly. // TODO(tsepez): Doesn't handle bidi properly. -bool ElideString(const string16& input, int max_len, string16* output); +UI_API bool ElideString(const string16& input, int max_len, + string16* output); // Reformat |input| into |output| so that it fits into a |max_rows| by // |max_cols| rectangle of characters. Input newlines are respected, but @@ -113,8 +115,9 @@ bool ElideString(const string16& input, int max_len, string16* output); // intra-word (respecting UTF-16 surrogate pairs) as necssary. Truncation // (indicated by an added 3 dots) occurs if the result is still too long. // Returns true if the input had to be truncated (and not just reformatted). -bool ElideRectangleString(const string16& input, size_t max_rows, - size_t max_cols, bool strict, string16* output); +UI_API bool ElideRectangleString(const string16& input, size_t max_rows, + size_t max_cols, bool strict, + string16* output); } // namespace ui diff --git a/ui/base/theme_provider.h b/ui/base/theme_provider.h index 43aa28f..1fde089 100644 --- a/ui/base/theme_provider.h +++ b/ui/base/theme_provider.h @@ -8,6 +8,7 @@ #include "base/basictypes.h" #include "third_party/skia/include/core/SkColor.h" +#include "ui/ui_api.h" #if defined(OS_MACOSX) #ifdef __OBJC__ @@ -39,7 +40,7 @@ namespace ui { // //////////////////////////////////////////////////////////////////////////////// -class ThemeProvider { +class UI_API ThemeProvider { public: virtual ~ThemeProvider(); diff --git a/ui/base/ui_base_paths.h b/ui/base/ui_base_paths.h index 3620f29..92f10d6 100644 --- a/ui/base/ui_base_paths.h +++ b/ui/base/ui_base_paths.h @@ -6,6 +6,8 @@ #define UI_BASE_UI_BASE_PATHS_H_ #pragma once +#include "ui/ui_api.h" + // This file declares path keys for the app module. These can be used with // the PathService to access various special directories and files. @@ -26,7 +28,7 @@ enum { }; // Call once to register the provider for the path keys defined above. -void RegisterPathProvider(); +UI_API void RegisterPathProvider(); } // namespace ui diff --git a/ui/base/ui_base_switches.h b/ui/base/ui_base_switches.h index 07ab98f..15183e5 100644 --- a/ui/base/ui_base_switches.h +++ b/ui/base/ui_base_switches.h @@ -8,10 +8,12 @@ #define UI_BASE_UI_BASE_SWITCHES_H_ #pragma once +#include "ui/ui_api.h" + namespace switches { -extern const char kLang[]; -extern const char kLocalePak[]; +UI_API extern const char kLang[]; +UI_API extern const char kLocalePak[]; } // namespace switches diff --git a/ui/base/view_prop.h b/ui/base/view_prop.h index ae185e4..04703be 100644 --- a/ui/base/view_prop.h +++ b/ui/base/view_prop.h @@ -9,6 +9,7 @@ #include "base/basictypes.h" #include "base/memory/ref_counted.h" #include "ui/gfx/native_widget_types.h" +#include "ui/ui_api.h" namespace ui { @@ -16,7 +17,7 @@ namespace ui { // designed as a replacement for the Win32's SetProp, but does not make use of // window manager memory. ViewProp shares similar semantics as SetProp, the // value for a particular view/key pair comes from the last ViewProp created. -class ViewProp { +class UI_API ViewProp { public: // Associates data with a view/key pair. If a ViewProp has already been // created for the specified pair |data| replaces the current value. diff --git a/ui/base/win/hwnd_util.h b/ui/base/win/hwnd_util.h index a004654..a5bef49 100644 --- a/ui/base/win/hwnd_util.h +++ b/ui/base/win/hwnd_util.h @@ -9,6 +9,7 @@ #include <windows.h> #include "base/string16.h" +#include "ui/ui_api.h" namespace gfx { class Size; @@ -18,35 +19,35 @@ namespace ui { // A version of the GetClassNameW API that returns the class name in an // string16. An empty result indicates a failure to get the class name. -string16 GetClassName(HWND hwnd); +UI_API string16 GetClassName(HWND hwnd); // Useful for subclassing a HWND. Returns the previous window procedure. -WNDPROC SetWindowProc(HWND hwnd, WNDPROC wndproc); +UI_API WNDPROC SetWindowProc(HWND hwnd, WNDPROC wndproc); // Pointer-friendly wrappers around Get/SetWindowLong(..., GWLP_USERDATA, ...) // Returns the previously set value. -void* SetWindowUserData(HWND hwnd, void* user_data); -void* GetWindowUserData(HWND hwnd); +UI_API void* SetWindowUserData(HWND hwnd, void* user_data); +UI_API void* GetWindowUserData(HWND hwnd); // Returns true if the specified window is the current active top window or one // of its children. -bool DoesWindowBelongToActiveWindow(HWND window); +UI_API bool DoesWindowBelongToActiveWindow(HWND window); // Sizes the window to have a client or window size (depending on the value of // |pref_is_client|) of pref, then centers the window over parent, ensuring the // window fits on screen. -void CenterAndSizeWindow(HWND parent, - HWND window, - const gfx::Size& pref, - bool pref_is_client); +UI_API void CenterAndSizeWindow(HWND parent, + HWND window, + const gfx::Size& pref, + bool pref_is_client); // If |hwnd| is NULL logs various thing and CHECKs. Invoke right after calling // CreateWindow. -void CheckWindowCreated(HWND hwnd); +UI_API void CheckWindowCreated(HWND hwnd); // Shows the system menu for |window| and sends the selected command (if the // user selected something. -void ShowSystemMenu(HWND window, int screen_x, int screen_y); +UI_API void ShowSystemMenu(HWND window, int screen_x, int screen_y); } // namespace ui diff --git a/ui/base/win/ime_input.h b/ui/base/win/ime_input.h index 9e8ab75..887a5c3 100644 --- a/ui/base/win/ime_input.h +++ b/ui/base/win/ime_input.h @@ -15,6 +15,7 @@ #include "base/i18n/rtl.h" #include "base/string16.h" #include "ui/gfx/rect.h" +#include "ui/ui_api.h" namespace ui { @@ -73,7 +74,7 @@ struct CompositionText; // hand, we can NEVER disable either TSF or CUAS in Windows Vista, i.e. // THIS CLASS IS NOT ONLY USED ON THE INPUT CONTEXTS OF EAST-ASIAN // LANGUAGES BUT ALSO USED ON THE INPUT CONTEXTS OF ALL LANGUAGES. -class ImeInput { +class UI_API ImeInput { public: ImeInput(); ~ImeInput(); diff --git a/ui/base/win/shell.h b/ui/base/win/shell.h index cc32477..359954e 100644 --- a/ui/base/win/shell.h +++ b/ui/base/win/shell.h @@ -9,6 +9,7 @@ #include <windows.h> #include "base/string16.h" +#include "ui/ui_api.h" class FilePath; @@ -19,12 +20,12 @@ namespace win { // default application registered for the file specified by 'full_path', // ask the user, via the Windows "Open With" dialog. // Returns 'true' on successful open, 'false' otherwise. -bool OpenItemViaShell(const FilePath& full_path); +UI_API bool OpenItemViaShell(const FilePath& full_path); // The download manager now writes the alternate data stream with the // zone on all downloads. This function is equivalent to OpenItemViaShell // without showing the zone warning dialog. -bool OpenItemViaShellNoZoneCheck(const FilePath& full_path); +UI_API bool OpenItemViaShellNoZoneCheck(const FilePath& full_path); // Ask the user, via the Windows "Open With" dialog, for an application to use // to open the file specified by 'full_path'. @@ -34,7 +35,7 @@ bool OpenItemWithExternalApp(const string16& full_path); // Sets the application id given as the Application Model ID for the window // specified. This method is used to insure that different web applications // do not group together on the Win7 task bar. -void SetAppIdForWindow(const string16& app_id, HWND hwnd); +UI_API void SetAppIdForWindow(const string16& app_id, HWND hwnd); } // namespace win } // namespace ui diff --git a/ui/base/win/window_impl.h b/ui/base/win/window_impl.h index 94d6678..863c484 100644 --- a/ui/base/win/window_impl.h +++ b/ui/base/win/window_impl.h @@ -16,6 +16,7 @@ #include "base/logging.h" #include "ui/gfx/native_widget_types.h" #include "ui/gfx/rect.h" +#include "ui/ui_api.h" namespace ui { @@ -40,7 +41,7 @@ class MessageMapInterface { // Windows. // /////////////////////////////////////////////////////////////////////////////// -class WindowImpl : public MessageMapInterface { +class UI_API WindowImpl : public MessageMapInterface { public: WindowImpl(); virtual ~WindowImpl(); diff --git a/ui/base/x/active_window_watcher_x.h b/ui/base/x/active_window_watcher_x.h index 9a253f5..b11c1ba 100644 --- a/ui/base/x/active_window_watcher_x.h +++ b/ui/base/x/active_window_watcher_x.h @@ -12,13 +12,14 @@ #include "base/memory/singleton.h" #include "base/observer_list.h" #include "ui/base/gtk/gtk_signal.h" +#include "ui/ui_api.h" namespace ui { // This is a helper class that is used to keep track of which window the X // window manager thinks is active. Add an Observer to listener for changes to // the active window. -class ActiveWindowWatcherX { +class UI_API ActiveWindowWatcherX { public: class Observer { public: diff --git a/ui/base/x/x11_util.h b/ui/base/x/x11_util.h index 7c985ae..1e287dd 100644 --- a/ui/base/x/x11_util.h +++ b/ui/base/x/x11_util.h @@ -16,6 +16,7 @@ #include <vector> #include "base/basictypes.h" +#include "ui/ui_api.h" typedef unsigned long Atom; typedef struct _GdkDrawable GdkWindow; @@ -36,9 +37,9 @@ namespace ui { // These functions cache their results --------------------------------- // Check if there's an open connection to an X server. -bool XDisplayExists(); +UI_API bool XDisplayExists(); // Return an X11 connection for the current, primary display. -Display* GetXDisplay(); +UI_API Display* GetXDisplay(); // X shared memory comes in three flavors: // 1) No SHM support, @@ -50,10 +51,10 @@ enum SharedMemorySupport { SHARED_MEMORY_PIXMAP }; // Return the shared memory type of our X connection. -SharedMemorySupport QuerySharedMemorySupport(Display* dpy); +UI_API SharedMemorySupport QuerySharedMemorySupport(Display* dpy); // Return true iff the display supports Xrender -bool QueryRenderSupport(Display* dpy); +UI_API bool QueryRenderSupport(Display* dpy); // Return the default screen number for the display int GetDefaultScreen(Display* display); @@ -61,31 +62,31 @@ int GetDefaultScreen(Display* display); // These functions do not cache their results -------------------------- // Get the X window id for the default root window -XID GetX11RootWindow(); +UI_API XID GetX11RootWindow(); // Returns the user's current desktop. bool GetCurrentDesktop(int* desktop); // Get the X window id for the given GTK widget. -XID GetX11WindowFromGtkWidget(GtkWidget* widget); +UI_API XID GetX11WindowFromGtkWidget(GtkWidget* widget); XID GetX11WindowFromGdkWindow(GdkWindow* window); // Get a Visual from the given widget. Since we don't include the Xlib // headers, this is returned as a void*. -void* GetVisualFromGtkWidget(GtkWidget* widget); +UI_API void* GetVisualFromGtkWidget(GtkWidget* widget); // Return the number of bits-per-pixel for a pixmap of the given depth -int BitsPerPixelForPixmapDepth(Display* display, int depth); +UI_API int BitsPerPixelForPixmapDepth(Display* display, int depth); // Returns true if |window| is visible. -bool IsWindowVisible(XID window); +UI_API bool IsWindowVisible(XID window); // Returns the bounds of |window|. -bool GetWindowRect(XID window, gfx::Rect* rect); +UI_API bool GetWindowRect(XID window, gfx::Rect* rect); // Return true if |window| has any property with |property_name|. -bool PropertyExists(XID window, const std::string& property_name); +UI_API bool PropertyExists(XID window, const std::string& property_name); // Get the value of an int, int array, atom array or string property. On // success, true is returned and the value is stored in |value|. bool GetIntProperty(XID window, const std::string& property_name, int* value); bool GetIntArrayProperty(XID window, const std::string& property_name, std::vector<int>* value); -bool GetAtomArrayProperty(XID window, const std::string& property_name, - std::vector<Atom>* value); -bool GetStringProperty( +UI_API bool GetAtomArrayProperty(XID window, const std::string& property_name, + std::vector<Atom>* value); +UI_API bool GetStringProperty( XID window, const std::string& property_name, std::string* value); // Get |window|'s parent window, or None if |window| is the root window. @@ -113,11 +114,12 @@ class EnumerateWindowsDelegate { // Enumerates all windows in the current display. Will recurse into child // windows up to a depth of |max_depth|. -bool EnumerateAllWindows(EnumerateWindowsDelegate* delegate, int max_depth); +UI_API bool EnumerateAllWindows(EnumerateWindowsDelegate* delegate, + int max_depth); // Returns all children windows of a given window in top-to-bottom stacking // order. -bool GetXWindowStack(XID window, std::vector<XID>* windows); +UI_API bool GetXWindowStack(XID window, std::vector<XID>* windows); // Restack a window in relation to one of its siblings. If |above| is true, // |window| will be stacked directly above |sibling|; otherwise it will stacked @@ -127,36 +129,38 @@ void RestackWindow(XID window, XID sibling, bool above); // Return a handle to a X ShmSeg. |shared_memory_key| is a SysV // IPC key. The shared memory region must contain 32-bit pixels. -XSharedMemoryId AttachSharedMemory(Display* display, int shared_memory_support); -void DetachSharedMemory(Display* display, XSharedMemoryId shmseg); +UI_API XSharedMemoryId AttachSharedMemory(Display* display, + int shared_memory_support); +UI_API void DetachSharedMemory(Display* display, XSharedMemoryId shmseg); // Return a handle to an XRender picture where |pixmap| is a handle to a // pixmap containing Skia ARGB data. -XID CreatePictureFromSkiaPixmap(Display* display, XID pixmap); +UI_API XID CreatePictureFromSkiaPixmap(Display* display, XID pixmap); // Draws ARGB data on the given pixmap using the given GC, converting to the // server side visual depth as needed. Destination is assumed to be the same // dimensions as |data| or larger. |data| is also assumed to be in row order // with each line being exactly |width| * 4 bytes long. -void PutARGBImage(Display* display, void* visual, int depth, XID pixmap, - void* pixmap_gc, const uint8* data, int width, int height); +UI_API void PutARGBImage(Display* display, void* visual, int depth, XID pixmap, + void* pixmap_gc, const uint8* data, int width, + int height); void FreePicture(Display* display, XID picture); void FreePixmap(Display* display, XID pixmap); // Get the window manager name. -bool GetWindowManagerName(std::string* name); +UI_API bool GetWindowManagerName(std::string* name); // Change desktop for |window| to the desktop of |destination| window. -bool ChangeWindowDesktop(XID window, XID destination); +UI_API bool ChangeWindowDesktop(XID window, XID destination); // Enable the default X error handlers. These will log the error and abort // the process if called. Use SetX11ErrorHandlers() from x11_util_internal.h // to set your own error handlers. -void SetDefaultX11ErrorHandlers(); +UI_API void SetDefaultX11ErrorHandlers(); // Return true if a given window is in full-screen mode. -bool IsX11WindowFullScreen(XID window); +UI_API bool IsX11WindowFullScreen(XID window); } // namespace ui diff --git a/ui/base/x/x11_util_internal.h b/ui/base/x/x11_util_internal.h index 31bbab2..778c012 100644 --- a/ui/base/x/x11_util_internal.h +++ b/ui/base/x/x11_util_internal.h @@ -19,32 +19,35 @@ extern "C" { #include <X11/extensions/Xrender.h> } +#include "ui/ui_api.h" + namespace ui { - // -------------------------------------------------------------------------- - // NOTE: these functions cache the results and must be called from the UI - // thread. - // Get the XRENDER format id for ARGB32 (Skia's format). - // - // NOTE:Currently this don't support multiple screens/displays. - XRenderPictFormat* GetRenderARGB32Format(Display* dpy); - - // Get the XRENDER format id for the default visual on the first screen. This - // is the format which our GTK window will have. - XRenderPictFormat* GetRenderVisualFormat(Display* dpy, Visual* visual); - - // -------------------------------------------------------------------------- - // X11 error handling. - // Sets the X Error Handlers. Passing NULL for either will enable the default - // error handler, which if called will log the error and abort the process. - void SetX11ErrorHandlers(XErrorHandler error_handler, - XIOErrorHandler io_error_handler); - - // NOTE: This function should not be called directly from the - // X11 Error handler because it queries the server to decode the - // error message, which may trigger other errors. A suitable workaround - // is to post a task in the error handler to call this function. - void LogErrorEventDescription(Display* dpy, const XErrorEvent& error_event); +// -------------------------------------------------------------------------- +// NOTE: these functions cache the results and must be called from the UI +// thread. +// Get the XRENDER format id for ARGB32 (Skia's format). +// +// NOTE:Currently this don't support multiple screens/displays. +XRenderPictFormat* GetRenderARGB32Format(Display* dpy); + +// Get the XRENDER format id for the default visual on the first screen. This +// is the format which our GTK window will have. +UI_API XRenderPictFormat* GetRenderVisualFormat(Display* dpy, Visual* visual); + +// -------------------------------------------------------------------------- +// X11 error handling. +// Sets the X Error Handlers. Passing NULL for either will enable the default +// error handler, which if called will log the error and abort the process. +UI_API void SetX11ErrorHandlers(XErrorHandler error_handler, + XIOErrorHandler io_error_handler); + +// NOTE: This function should not be called directly from the +// X11 Error handler because it queries the server to decode the +// error message, which may trigger other errors. A suitable workaround +// is to post a task in the error handler to call this function. +UI_API void LogErrorEventDescription(Display* dpy, + const XErrorEvent& error_event); } // namespace ui diff --git a/ui/gfx/blit.h b/ui/gfx/blit.h index da69870..1b93877 100644 --- a/ui/gfx/blit.h +++ b/ui/gfx/blit.h @@ -7,6 +7,7 @@ #pragma once #include "ui/gfx/native_widget_types.h" +#include "ui/ui_api.h" class SkCanvas; @@ -16,35 +17,35 @@ class Point; class Rect; // Blits a rectangle from the source context into the destination context. -void BlitContextToContext(NativeDrawingContext dst_context, - const Rect& dst_rect, - NativeDrawingContext src_context, - const Point& src_origin); +UI_API void BlitContextToContext(NativeDrawingContext dst_context, + const Rect& dst_rect, + NativeDrawingContext src_context, + const Point& src_origin); // Blits a rectangle from the source context into the destination canvas. -void BlitContextToCanvas(SkCanvas *dst_canvas, - const Rect& dst_rect, - NativeDrawingContext src_context, - const Point& src_origin); +UI_API void BlitContextToCanvas(SkCanvas *dst_canvas, + const Rect& dst_rect, + NativeDrawingContext src_context, + const Point& src_origin); // Blits a rectangle from the source canvas into the destination context. -void BlitCanvasToContext(NativeDrawingContext dst_context, - const Rect& dst_rect, - SkCanvas *src_canvas, - const Point& src_origin); +UI_API void BlitCanvasToContext(NativeDrawingContext dst_context, + const Rect& dst_rect, + SkCanvas *src_canvas, + const Point& src_origin); // Blits a rectangle from the source canvas into the destination canvas. -void BlitCanvasToCanvas(SkCanvas *dst_canvas, - const Rect& dst_rect, - SkCanvas *src_canvas, - const Point& src_origin); +UI_API void BlitCanvasToCanvas(SkCanvas *dst_canvas, + const Rect& dst_rect, + SkCanvas *src_canvas, + const Point& src_origin); // Scrolls the given subset of the given canvas by the given amount. // The canvas should not have a clip or a transform applied, since platforms // may implement those operations differently. -void ScrollCanvas(SkCanvas* canvas, - const Rect& clip, - const Point& amount); +UI_API void ScrollCanvas(SkCanvas* canvas, + const Rect& clip, + const Point& amount); } // namespace gfx diff --git a/ui/gfx/canvas.h b/ui/gfx/canvas.h index 5154965..2d2a55b 100644 --- a/ui/gfx/canvas.h +++ b/ui/gfx/canvas.h @@ -12,6 +12,7 @@ // TODO(beng): remove this include when we no longer depend on SkTypes. #include "skia/ext/platform_canvas.h" #include "ui/gfx/native_widget_types.h" +#include "ui/ui_api.h" namespace ui { class Transform; @@ -28,7 +29,7 @@ class Point; class Rect; // TODO(beng): documentation. -class Canvas { +class UI_API Canvas { public: // Specifies the alignment for text rendered with the DrawStringInt method. enum { @@ -229,7 +230,7 @@ class Canvas { virtual const CanvasSkia* AsCanvasSkia() const; }; -class CanvasPaint { +class UI_API CanvasPaint { public: virtual ~CanvasPaint() {} diff --git a/ui/gfx/canvas_direct2d.h b/ui/gfx/canvas_direct2d.h index 83a439c..bf454cf 100644 --- a/ui/gfx/canvas_direct2d.h +++ b/ui/gfx/canvas_direct2d.h @@ -15,7 +15,7 @@ namespace gfx { -class CanvasDirect2D : public Canvas { +class UI_API CanvasDirect2D : public Canvas { public: // Creates an empty Canvas. explicit CanvasDirect2D(ID2D1RenderTarget* rt); diff --git a/ui/gfx/canvas_skia.h b/ui/gfx/canvas_skia.h index ae2d9ba..d522115 100644 --- a/ui/gfx/canvas_skia.h +++ b/ui/gfx/canvas_skia.h @@ -34,8 +34,7 @@ class Canvas; // source and destination colors are combined. Unless otherwise specified, // the variant that does not take a SkXfermode::Mode uses a transfer mode // of kSrcOver_Mode. -class CanvasSkia : public skia::PlatformCanvas, - public Canvas { +class UI_API CanvasSkia : public skia::PlatformCanvas, public Canvas { public: enum TruncateFadeMode { TruncateFadeTail, diff --git a/ui/gfx/codec/jpeg_codec.h b/ui/gfx/codec/jpeg_codec.h index df535c2..0106bad 100644 --- a/ui/gfx/codec/jpeg_codec.h +++ b/ui/gfx/codec/jpeg_codec.h @@ -9,6 +9,8 @@ #include <stddef.h> #include <vector> +#include "ui/ui_api.h" + class SkBitmap; namespace gfx { @@ -17,7 +19,7 @@ namespace gfx { // which has an inconvenient interface for callers. This is only used for UI // elements, WebKit has its own more complicated JPEG decoder which handles, // among other things, partially downloaded data. -class JPEGCodec { +class UI_API JPEGCodec { public: enum ColorFormat { // 3 bytes per pixel (packed), in RGB order regardless of endianness. diff --git a/ui/gfx/codec/png_codec.h b/ui/gfx/codec/png_codec.h index 4632ac1..a850b09 100644 --- a/ui/gfx/codec/png_codec.h +++ b/ui/gfx/codec/png_codec.h @@ -10,6 +10,7 @@ #include <vector> #include "base/basictypes.h" +#include "ui/ui_api.h" class SkBitmap; @@ -23,7 +24,7 @@ class Size; // isn't as robust as would be required for a browser (see Decode() for more). // WebKit has its own more complicated PNG decoder which handles, among other // things, partially downloaded data. -class PNGCodec { +class UI_API PNGCodec { public: enum ColorFormat { // 3 bytes per pixel (packed), in RGB order regardless of endianness. @@ -43,7 +44,7 @@ class PNGCodec { }; // Represents a comment in the tEXt ancillary chunk of the png. - struct Comment { + struct UI_API Comment { Comment(const std::string& k, const std::string& t); ~Comment(); diff --git a/ui/gfx/color_analysis.h b/ui/gfx/color_analysis.h index c71a386..61f2cd7 100644 --- a/ui/gfx/color_analysis.h +++ b/ui/gfx/color_analysis.h @@ -11,6 +11,7 @@ #include "base/memory/ref_counted.h" #include "base/memory/ref_counted_memory.h" #include "third_party/skia/include/core/SkColor.h" +#include "ui/ui_api.h" namespace color_utils { @@ -18,7 +19,7 @@ namespace color_utils { // stubbing out for things like unit tests. Might be useful to pass more // arguments into the GetSample method in the future (such as which // cluster is being worked on, etc.). -class KMeanImageSampler { +class UI_API KMeanImageSampler { public: virtual int GetSample(int width, int height) = 0; @@ -37,7 +38,7 @@ class RandomSampler : public KMeanImageSampler { }; // This sampler will pick pixels from an evenly spaced grid. -class GridSampler : public KMeanImageSampler { +class UI_API GridSampler : public KMeanImageSampler { public: GridSampler(); virtual ~GridSampler(); @@ -102,10 +103,10 @@ SkColor CalculateKMeanColorOfPNG(scoped_refptr<RefCountedMemory> png, uint32_t darkness_limit, uint32_t brightness_limit); -SkColor CalculateKMeanColorOfPNG(scoped_refptr<RefCountedMemory> png, - uint32_t darkness_limit, - uint32_t brightness_limit, - KMeanImageSampler& sampler); +UI_API SkColor CalculateKMeanColorOfPNG(scoped_refptr<RefCountedMemory> png, + uint32_t darkness_limit, + uint32_t brightness_limit, + KMeanImageSampler& sampler); } // namespace color_utils diff --git a/ui/gfx/color_utils.h b/ui/gfx/color_utils.h index 86eb055..007d3a2 100644 --- a/ui/gfx/color_utils.h +++ b/ui/gfx/color_utils.h @@ -7,6 +7,7 @@ #pragma once #include "third_party/skia/include/core/SkColor.h" +#include "ui/ui_api.h" class SkBitmap; @@ -22,11 +23,11 @@ struct HSL { unsigned char GetLuminanceForColor(SkColor color); // Calculated according to http://www.w3.org/TR/WCAG20/#relativeluminancedef -double RelativeLuminance(SkColor color); +UI_API double RelativeLuminance(SkColor color); // Note: these transformations assume sRGB as the source color space -void SkColorToHSL(SkColor c, HSL* hsl); -SkColor HSLToSkColor(const HSL& hsl, SkAlpha alpha); +UI_API void SkColorToHSL(SkColor c, HSL* hsl); +UI_API SkColor HSLToSkColor(const HSL& hsl, SkAlpha alpha); // HSL-Shift an SkColor. The shift values are in the range of 0-1, with the // option to specify -1 for 'no change'. The shift values are defined as: @@ -42,7 +43,7 @@ SkColor HSLToSkColor(const HSL& hsl, SkAlpha alpha); // 0 = remove all lightness (make all pixels black). // 0.5 = leave unchanged. // 1 = full lightness (make all pixels white). -SkColor HSLShift(SkColor color, const HSL& shift); +UI_API SkColor HSLShift(SkColor color, const HSL& shift); // Determine if a given alpha value is nearly completely transparent. bool IsColorCloseToTransparent(SkAlpha alpha); @@ -57,13 +58,14 @@ SkColor GetAverageColorOfFavicon(SkBitmap* bitmap, SkAlpha alpha); // Builds a histogram based on the Y' of the Y'UV representation of // this image. -void BuildLumaHistogram(SkBitmap* bitmap, int histogram[256]); +UI_API void BuildLumaHistogram(SkBitmap* bitmap, int histogram[256]); // Returns a blend of the supplied colors, ranging from |background| (for // |alpha| == 0) to |foreground| (for |alpha| == 255). The alpha channels of // the supplied colors are also taken into account, so the returned color may // be partially transparent. -SkColor AlphaBlend(SkColor foreground, SkColor background, SkAlpha alpha); +UI_API SkColor AlphaBlend(SkColor foreground, SkColor background, + SkAlpha alpha); // Given a foreground and background color, try to return a foreground color // that is "readable" over the background color by luma-inverting the foreground @@ -72,10 +74,10 @@ SkColor AlphaBlend(SkColor foreground, SkColor background, SkAlpha alpha); // // NOTE: This won't do anything but waste time if the supplied foreground color // has a luma value close to the midpoint (0.5 in the HSL representation). -SkColor GetReadableColor(SkColor foreground, SkColor background); +UI_API SkColor GetReadableColor(SkColor foreground, SkColor background); // Gets a Windows system color as a SkColor -SkColor GetSysSkColor(int which); +UI_API SkColor GetSysSkColor(int which); } // namespace color_utils diff --git a/ui/gfx/compositor/compositor.gyp b/ui/gfx/compositor/compositor.gyp index e4c3fd1..010f973 100644 --- a/ui/gfx/compositor/compositor.gyp +++ b/ui/gfx/compositor/compositor.gyp @@ -3,6 +3,9 @@ # found in the LICENSE file. { + 'variables': { + 'chromium_code': 1, + }, 'target_defaults': { 'sources/': [ ['exclude', '_(gl|win)\\.(cc?)$'], @@ -24,7 +27,7 @@ '<(DEPTH)/base/base.gyp:base', '<(DEPTH)/skia/skia.gyp:skia', '<(DEPTH)/ui/gfx/gl/gl.gyp:gl', - '<(DEPTH)/ui/ui.gyp:ui_gfx', + '<(DEPTH)/ui/ui.gyp:ui', ], 'sources': [ 'compositor.cc', diff --git a/ui/gfx/font.h b/ui/gfx/font.h index 3d7ce25..9ccfadd2 100644 --- a/ui/gfx/font.h +++ b/ui/gfx/font.h @@ -11,6 +11,7 @@ #include "base/memory/ref_counted.h" #include "base/string16.h" #include "ui/gfx/native_widget_types.h" +#include "ui/ui_api.h" namespace gfx { @@ -18,7 +19,7 @@ class PlatformFont; // Font provides a wrapper around an underlying font. Copy and assignment // operators are explicitly allowed, and cheap. -class Font { +class UI_API Font { public: // The following constants indicate the font style. enum FontStyle { diff --git a/ui/gfx/gdi_util.h b/ui/gfx/gdi_util.h index 8f0216e..487a042 100644 --- a/ui/gfx/gdi_util.h +++ b/ui/gfx/gdi_util.h @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 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. @@ -10,11 +10,12 @@ #include <windows.h> #include "ui/gfx/rect.h" +#include "ui/ui_api.h" namespace gfx { // Creates a BITMAPINFOHEADER structure given the bitmap's size. -void CreateBitmapHeader(int width, int height, BITMAPINFOHEADER* hdr); +UI_API void CreateBitmapHeader(int width, int height, BITMAPINFOHEADER* hdr); // Creates a BITMAPINFOHEADER structure given the bitmap's size and // color depth in bits per pixel. @@ -24,14 +25,14 @@ void CreateBitmapHeaderWithColorDepth(int width, int height, int color_depth, // Creates a BITMAPV4HEADER structure given the bitmap's size. You probably // only need to use BMP V4 if you need transparency (alpha channel). This // function sets the AlphaMask to 0xff000000. -void CreateBitmapV4Header(int width, int height, BITMAPV4HEADER* hdr); +UI_API void CreateBitmapV4Header(int width, int height, BITMAPV4HEADER* hdr); // Creates a monochrome bitmap header. void CreateMonochromeBitmapHeader(int width, int height, BITMAPINFOHEADER* hdr); // Modify the given hrgn by subtracting the given rectangles. -void SubtractRectanglesFromRegion(HRGN hrgn, - const std::vector<gfx::Rect>& cutouts); +UI_API void SubtractRectanglesFromRegion(HRGN hrgn, + const std::vector<gfx::Rect>& cutouts); } // namespace gfx diff --git a/ui/gfx/gfx_paths.h b/ui/gfx/gfx_paths.h index 6be0cc3..d08225f 100644 --- a/ui/gfx/gfx_paths.h +++ b/ui/gfx/gfx_paths.h @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 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. @@ -6,6 +6,8 @@ #define UI_GFX_GFX_PATHS_H_ #pragma once +#include "ui/ui_api.h" + // This file declares path keys for the app module. These can be used with // the PathService to access various special directories and files. @@ -21,7 +23,7 @@ enum { }; // Call once to register the provider for the path keys defined above. -void RegisterPathProvider(); +UI_API void RegisterPathProvider(); } // namespace gfx diff --git a/ui/gfx/gl/gl.gyp b/ui/gfx/gl/gl.gyp index 2685fbf..f7c7879 100644 --- a/ui/gfx/gl/gl.gyp +++ b/ui/gfx/gl/gl.gyp @@ -14,8 +14,7 @@ 'dependencies': [ '<(DEPTH)/base/base.gyp:base', '<(DEPTH)/skia/skia.gyp:skia', - '<(DEPTH)/ui/ui.gyp:ui_base', - '<(DEPTH)/ui/ui.gyp:ui_gfx', + '<(DEPTH)/ui/ui.gyp:ui', ], 'variables': { 'gl_binding_output_dir': '<(SHARED_INTERMEDIATE_DIR)/ui/gfx/gl', diff --git a/ui/gfx/gtk_native_view_id_manager.h b/ui/gfx/gtk_native_view_id_manager.h index 2a651a0..2fe9b7b 100644 --- a/ui/gfx/gtk_native_view_id_manager.h +++ b/ui/gfx/gtk_native_view_id_manager.h @@ -11,6 +11,7 @@ #include "base/memory/singleton.h" #include "base/synchronization/lock.h" #include "ui/gfx/native_widget_types.h" +#include "ui/ui_api.h" typedef unsigned long XID; struct _GtkPreserveWindow; @@ -30,7 +31,7 @@ struct _GtkPreserveWindow; // pointers and observes the various signals from the widget for when an X // window is created, destroyed etc. Thus it provides a thread safe mapping // from NativeViewIds to the current XID for that widget. -class GtkNativeViewManager { +class UI_API GtkNativeViewManager { public: // Returns the singleton instance. static GtkNativeViewManager* GetInstance(); diff --git a/ui/gfx/gtk_preserve_window.h b/ui/gfx/gtk_preserve_window.h index 3c9b1d8..be0bed1 100644 --- a/ui/gfx/gtk_preserve_window.h +++ b/ui/gfx/gtk_preserve_window.h @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 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. @@ -9,6 +9,8 @@ #include <gdk/gdk.h> #include <gtk/gtk.h> +#include "ui/ui_api.h" + // GtkFixed creates an X window when realized and destroys an X window // when unrealized. GtkPreserveWindow allows overrides this // behaviour. When preserve is set (via gtk_preserve_window_set_preserve), @@ -45,7 +47,7 @@ struct _GtkPreserveWindowClass { }; GType gtk_preserve_window_get_type() G_GNUC_CONST; -GtkWidget* gtk_preserve_window_new(); +UI_API GtkWidget* gtk_preserve_window_new(); // Whether or not we should preserve associated windows as the widget // is realized or unrealized. @@ -56,8 +58,8 @@ void gtk_preserve_window_set_preserve(GtkPreserveWindow* widget, // Whether or not someone else will gdk_window_resize the GdkWindow associated // with this widget (needed by the GPU process to synchronize resizing // with swapped between front and back buffer). -void gtk_preserve_window_delegate_resize(GtkPreserveWindow* widget, - gboolean delegate); +UI_API void gtk_preserve_window_delegate_resize(GtkPreserveWindow* widget, + gboolean delegate); G_END_DECLS diff --git a/ui/gfx/gtk_util.h b/ui/gfx/gtk_util.h index cf7bc04..5b802af 100644 --- a/ui/gfx/gtk_util.h +++ b/ui/gfx/gtk_util.h @@ -13,6 +13,7 @@ #include <vector> #include "base/memory/scoped_ptr.h" +#include "ui/ui_api.h" typedef struct _GdkPixbuf GdkPixbuf; typedef struct _GdkRegion GdkRegion; @@ -28,16 +29,16 @@ class Rect; // Call gtk_init() using the argc and argv from command_line. // gtk_init() wants an argc and argv that it can mutate; we provide those, // but leave the original CommandLine unaltered. -void GtkInitFromCommandLine(const CommandLine& command_line); +UI_API void GtkInitFromCommandLine(const CommandLine& command_line); // Convert and copy a SkBitmap to a GdkPixbuf. NOTE: this uses BGRAToRGBA, so // it is an expensive operation. The returned GdkPixbuf will have a refcount of // 1, and the caller is responsible for unrefing it when done. -GdkPixbuf* GdkPixbufFromSkBitmap(const SkBitmap* bitmap); +UI_API GdkPixbuf* GdkPixbufFromSkBitmap(const SkBitmap* bitmap); // Modify the given region by subtracting the given rectangles. -void SubtractRectanglesFromRegion(GdkRegion* region, - const std::vector<Rect>& cutouts); +UI_API void SubtractRectanglesFromRegion(GdkRegion* region, + const std::vector<Rect>& cutouts); // Returns the resolution (DPI) used by pango. A negative values means the // resolution hasn't been set. @@ -45,14 +46,15 @@ double GetPangoResolution(); // Returns a static instance of a GdkCursor* object, sharable across the // process. Caller must gdk_cursor_ref() it if they want to assume ownership. -GdkCursor* GetCursor(int type); +UI_API GdkCursor* GetCursor(int type); // Change windows accelerator style to GTK style. (GTK uses _ for // accelerators. Windows uses & with && as an escape for &.) -std::string ConvertAcceleratorsFromWindowsStyle(const std::string& label); +UI_API std::string ConvertAcceleratorsFromWindowsStyle( + const std::string& label); // Removes the "&" accelerators from a Windows label. -std::string RemoveWindowsStyleAccelerators(const std::string& label); +UI_API std::string RemoveWindowsStyleAccelerators(const std::string& label); // Makes a copy of |pixels| with the ordering changed from BGRA to RGBA. // The caller is responsible for free()ing the data. If |stride| is 0, it's diff --git a/ui/gfx/icon_util.h b/ui/gfx/icon_util.h index ae23601..439ba59 100644 --- a/ui/gfx/icon_util.h +++ b/ui/gfx/icon_util.h @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 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. @@ -9,7 +9,9 @@ #include <windows.h> #include <string> #include <vector> + #include "base/basictypes.h" +#include "ui/ui_api.h" namespace gfx { class Size; @@ -48,7 +50,7 @@ class SkBitmap; // ::DestroyIcon(icon); // /////////////////////////////////////////////////////////////////////////////// -class IconUtil { +class UI_API IconUtil { public: // Given an SkBitmap object, the function converts the bitmap to a Windows // icon and returns the corresponding HICON handle. If the function cannot diff --git a/ui/gfx/image/image.h b/ui/gfx/image/image.h index a57b519..6f6d161 100644 --- a/ui/gfx/image/image.h +++ b/ui/gfx/image/image.h @@ -23,8 +23,8 @@ #include "base/basictypes.h" #include "base/gtest_prod_util.h" #include "base/memory/ref_counted.h" -#include "build/build_config.h" -#include "ui/gfx/native_widget_types.h" // Forward-declares GdkPixbuf and NSImage. +#include "ui/gfx/native_widget_types.h" +#include "ui/ui_api.h" class SkBitmap; @@ -40,7 +40,7 @@ class ImageRep; class ImageStorage; } -class Image { +class UI_API Image { public: enum RepresentationType { kImageRepGdk, diff --git a/ui/gfx/image/image_util.h b/ui/gfx/image/image_util.h index b207830..a702dae 100644 --- a/ui/gfx/image/image_util.h +++ b/ui/gfx/image/image_util.h @@ -9,6 +9,7 @@ #include <vector> #include "base/basictypes.h" +#include "ui/ui_api.h" namespace gfx { class Image; @@ -18,12 +19,13 @@ namespace gfx { // Creates an image from the given PNG-encoded input. The caller owns the // returned Image. If there was an error creating the image, returns NULL. -Image* ImageFromPNGEncodedData(const unsigned char* input, size_t input_size); +UI_API Image* ImageFromPNGEncodedData(const unsigned char* input, + size_t input_size); // Fills the |dst| vector with PNG-encoded bytes based on the given Image. // Returns true if the Image was encoded successfully. -bool PNGEncodedDataFromImage(const Image& image, - std::vector<unsigned char>* dst); +UI_API bool PNGEncodedDataFromImage(const Image& image, + std::vector<unsigned char>* dst); } diff --git a/ui/gfx/insets.h b/ui/gfx/insets.h index 31909b4..71af94d 100644 --- a/ui/gfx/insets.h +++ b/ui/gfx/insets.h @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 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. @@ -6,14 +6,15 @@ #define UI_GFX_INSETS_H_ #pragma once +#include <string> + #include "build/build_config.h" +#include "ui/ui_api.h" #if defined(OS_POSIX) && !defined(OS_MACOSX) #include <gtk/gtkstyle.h> #endif -#include <string> - namespace gfx { // @@ -21,7 +22,7 @@ namespace gfx { // leave at each of its edges). // -class Insets { +class UI_API Insets { public: Insets() : top_(0), left_(0), bottom_(0), right_(0) {} Insets(int top, int left, int bottom, int right) diff --git a/ui/gfx/interpolated_transform.h b/ui/gfx/interpolated_transform.h index ce78224..dfd9809 100644 --- a/ui/gfx/interpolated_transform.h +++ b/ui/gfx/interpolated_transform.h @@ -23,7 +23,7 @@ namespace ui { // scale from 0.3 to 1 from between times 0.75 and 1. // /////////////////////////////////////////////////////////////////////////////// -class InterpolatedTransform { +class UI_API InterpolatedTransform { public: InterpolatedTransform(); // The interpolated transform varies only when t in (start_time, end_time). @@ -72,7 +72,7 @@ class InterpolatedTransform { // Represents an animated rotation. // /////////////////////////////////////////////////////////////////////////////// -class InterpolatedRotation : public InterpolatedTransform { +class UI_API InterpolatedRotation : public InterpolatedTransform { public: InterpolatedRotation(float start_degrees, float end_degrees); InterpolatedRotation(float start_degrees, @@ -97,7 +97,7 @@ class InterpolatedRotation : public InterpolatedTransform { // Represents an animated scale. // /////////////////////////////////////////////////////////////////////////////// -class InterpolatedScale : public InterpolatedTransform { +class UI_API InterpolatedScale : public InterpolatedTransform { public: InterpolatedScale(float start_scale, float end_scale); InterpolatedScale(float start_scale, @@ -116,7 +116,7 @@ class InterpolatedScale : public InterpolatedTransform { DISALLOW_COPY_AND_ASSIGN(InterpolatedScale); }; -class InterpolatedTranslation : public InterpolatedTransform { +class UI_API InterpolatedTranslation : public InterpolatedTransform { public: InterpolatedTranslation(const gfx::Point& start_pos, const gfx::Point& end_pos); @@ -145,7 +145,7 @@ class InterpolatedTranslation : public InterpolatedTransform { // See InterpolatedTransformAboutPivot for an example of its usage. // /////////////////////////////////////////////////////////////////////////////// -class InterpolatedConstantTransform : public InterpolatedTransform { +class UI_API InterpolatedConstantTransform : public InterpolatedTransform { public: InterpolatedConstantTransform(const ui::Transform& transform); virtual ~InterpolatedConstantTransform(); @@ -167,7 +167,7 @@ class InterpolatedConstantTransform : public InterpolatedTransform { // P * T * P^-1 where P is a constant transform to the new origin. // /////////////////////////////////////////////////////////////////////////////// -class InterpolatedTransformAboutPivot : public InterpolatedTransform { +class UI_API InterpolatedTransformAboutPivot : public InterpolatedTransform { public: // Takes ownership of the passed transform. InterpolatedTransformAboutPivot(const gfx::Point& pivot, diff --git a/ui/gfx/native_theme.h b/ui/gfx/native_theme.h index 650e2d1..665b78e 100644 --- a/ui/gfx/native_theme.h +++ b/ui/gfx/native_theme.h @@ -8,6 +8,7 @@ #include "skia/ext/platform_canvas.h" #include "ui/gfx/native_widget_types.h" +#include "ui/ui_api.h" namespace gfx { @@ -29,7 +30,7 @@ class Size; // // NativeTheme also supports getting the default size of a given part with // the GetPartSize() method. -class NativeTheme { +class UI_API NativeTheme { public: // The part to be painted / sized. enum Part { diff --git a/ui/gfx/native_theme_win.h b/ui/gfx/native_theme_win.h index 9df8ec8..4165b61 100644 --- a/ui/gfx/native_theme_win.h +++ b/ui/gfx/native_theme_win.h @@ -12,12 +12,13 @@ #define UI_GFX_NATIVE_THEME_WIN_H_ #pragma once -#include "ui/gfx/native_theme.h" -#include "ui/gfx/size.h" #include <windows.h> #include <uxtheme.h> + #include "base/basictypes.h" #include "third_party/skia/include/core/SkColor.h" +#include "ui/gfx/native_theme.h" +#include "ui/gfx/size.h" class SkCanvas; @@ -29,7 +30,7 @@ namespace gfx { // of several PaintXXX methods to an API, inherited from the NativeTheme base // class, that consists of a single Paint() method with a argument to indicate // what kind of part to paint. -class NativeThemeWin : public NativeTheme { +class UI_API NativeThemeWin : public NativeTheme { public: enum ThemeName { BUTTON, diff --git a/ui/gfx/native_widget_types.h b/ui/gfx/native_widget_types.h index 8f00f6e..479f366 100644 --- a/ui/gfx/native_widget_types.h +++ b/ui/gfx/native_widget_types.h @@ -7,7 +7,7 @@ #pragma once #include "base/basictypes.h" -#include "build/build_config.h" +#include "ui/ui_api.h" // This file provides cross platform typedefs for native widget types. // NativeWindow: this is a handle to a native, top-level window @@ -147,7 +147,7 @@ static inline NativeViewId IdFromNativeView(NativeView view) { } #elif defined(USE_X11) // Not inlined because it involves pulling too many headers. -NativeViewId IdFromNativeView(NativeView view); +UI_API NativeViewId IdFromNativeView(NativeView view); #endif // defined(USE_X11) diff --git a/ui/gfx/path.h b/ui/gfx/path.h index eec01fc3..88021db 100644 --- a/ui/gfx/path.h +++ b/ui/gfx/path.h @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 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. @@ -7,13 +7,13 @@ #pragma once #include "base/basictypes.h" -#include "ui/gfx/native_widget_types.h" - #include "third_party/skia/include/core/SkPath.h" +#include "ui/gfx/native_widget_types.h" +#include "ui/ui_api.h" namespace gfx { -class Path : public SkPath { +class UI_API Path : public SkPath { public: // Used by Path(Point,size_t) constructor. struct Point { diff --git a/ui/gfx/platform_font.h b/ui/gfx/platform_font.h index 5a312d8..83c7df4 100644 --- a/ui/gfx/platform_font.h +++ b/ui/gfx/platform_font.h @@ -11,12 +11,13 @@ #include "base/memory/ref_counted.h" #include "base/string16.h" #include "ui/gfx/native_widget_types.h" +#include "ui/ui_api.h" namespace gfx { class Font; -class PlatformFont : public base::RefCounted<PlatformFont> { +class UI_API PlatformFont : public base::RefCounted<PlatformFont> { public: // Create an appropriate PlatformFont implementation. static PlatformFont* CreateDefault(); diff --git a/ui/gfx/platform_font_win.h b/ui/gfx/platform_font_win.h index 422367e..a76fc8d 100644 --- a/ui/gfx/platform_font_win.h +++ b/ui/gfx/platform_font_win.h @@ -8,10 +8,11 @@ #include "base/memory/ref_counted.h" #include "ui/gfx/platform_font.h" +#include "ui/ui_api.h" namespace gfx { -class PlatformFontWin : public PlatformFont { +class UI_API PlatformFontWin : public PlatformFont { public: PlatformFontWin(); explicit PlatformFontWin(const Font& other); diff --git a/ui/gfx/point.h b/ui/gfx/point.h index b208c07..a872643 100644 --- a/ui/gfx/point.h +++ b/ui/gfx/point.h @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 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. @@ -10,6 +10,8 @@ #include <iosfwd> +#include "ui/ui_api.h" + #if defined(OS_WIN) typedef unsigned long DWORD; typedef struct tagPOINT POINT; @@ -20,7 +22,7 @@ typedef struct tagPOINT POINT; namespace gfx { // A point has an x and y coordinate. -class Point { +class UI_API Point { public: Point(); Point(int x, int y); @@ -94,7 +96,7 @@ class Point { int y_; }; -std::ostream& operator<<(std::ostream& out, const gfx::Point& p); +UI_API std::ostream& operator<<(std::ostream& out, const gfx::Point& p); } // namespace gfx diff --git a/ui/gfx/rect.h b/ui/gfx/rect.h index c65489f..0978edc 100644 --- a/ui/gfx/rect.h +++ b/ui/gfx/rect.h @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 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. @@ -28,7 +28,7 @@ namespace gfx { class Insets; -class Rect { +class UI_API Rect { public: Rect(); Rect(int width, int height); @@ -177,7 +177,7 @@ class Rect { gfx::Size size_; }; -std::ostream& operator<<(std::ostream& out, const gfx::Rect& r); +UI_API std::ostream& operator<<(std::ostream& out, const gfx::Rect& r); } // namespace gfx diff --git a/ui/gfx/scrollbar_size.h b/ui/gfx/scrollbar_size.h index 771b9db..151a185 100644 --- a/ui/gfx/scrollbar_size.h +++ b/ui/gfx/scrollbar_size.h @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 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. @@ -6,12 +6,14 @@ #define UI_GFX_SCROLLBAR_SIZE_H_ #pragma once +#include "ui/ui_api.h" + namespace gfx { // This should return the thickness, in pixels, of a scrollbar in web content. // This needs to match the values in WebCore's // ScrollbarThemeChromiumXXX.cpp::scrollbarThickness(). -int scrollbar_size(); +UI_API int scrollbar_size(); } // namespace gfx diff --git a/ui/gfx/size.h b/ui/gfx/size.h index 55468eae..20bff0f 100644 --- a/ui/gfx/size.h +++ b/ui/gfx/size.h @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 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. @@ -6,10 +6,11 @@ #define UI_GFX_SIZE_H_ #pragma once -#include "build/build_config.h" - #include <iosfwd> +#include "build/build_config.h" +#include "ui/ui_api.h" + #if defined(OS_WIN) typedef struct tagSIZE SIZE; #elif defined(OS_MACOSX) @@ -19,7 +20,7 @@ typedef struct tagSIZE SIZE; namespace gfx { // A size has width and height values. -class Size { +class UI_API Size { public: Size() : width_(0), height_(0) {} Size(int width, int height); @@ -75,7 +76,7 @@ class Size { int height_; }; -std::ostream& operator<<(std::ostream& out, const gfx::Size& s); +UI_API std::ostream& operator<<(std::ostream& out, const gfx::Size& s); } // namespace gfx diff --git a/ui/gfx/skbitmap_operations.h b/ui/gfx/skbitmap_operations.h index dce8e3c..f96bc95 100644 --- a/ui/gfx/skbitmap_operations.h +++ b/ui/gfx/skbitmap_operations.h @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 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. @@ -8,10 +8,11 @@ #include "base/gtest_prod_util.h" #include "ui/gfx/color_utils.h" +#include "ui/ui_api.h" class SkBitmap; -class SkBitmapOperations { +class UI_API SkBitmapOperations { public: // Create a bitmap that is an inverted image of the passed in image. // Each color becomes its inverse in the color wheel. So (255, 15, 0) becomes diff --git a/ui/gfx/skia_util.h b/ui/gfx/skia_util.h index f807979..7e3add6 100644 --- a/ui/gfx/skia_util.h +++ b/ui/gfx/skia_util.h @@ -10,6 +10,7 @@ #include "third_party/skia/include/core/SkColor.h" #include "third_party/skia/include/core/SkRect.h" +#include "ui/ui_api.h" class SkBitmap; class SkShader; @@ -19,8 +20,8 @@ namespace gfx { class Rect; // Convert between Skia and gfx rect types. -SkRect RectToSkRect(const gfx::Rect& rect); -gfx::Rect SkRectToRect(const SkRect& rect); +UI_API SkRect RectToSkRect(const gfx::Rect& rect); +UI_API gfx::Rect SkRectToRect(const SkRect& rect); // Creates a vertical gradient shader. The caller owns the shader. // Example usage to avoid leaks: @@ -28,17 +29,18 @@ gfx::Rect SkRectToRect(const SkRect& rect); // // (The old shader in the paint, if any, needs to be freed, and SkSafeUnref will // handle the NULL case.) -SkShader* CreateGradientShader(int start_point, - int end_point, - SkColor start_color, - SkColor end_color); +UI_API SkShader* CreateGradientShader(int start_point, + int end_point, + SkColor start_color, + SkColor end_color); // Returns true if the two bitmaps contain the same pixels. -bool BitmapsAreEqual(const SkBitmap& bitmap1, const SkBitmap& bitmap2); +UI_API bool BitmapsAreEqual(const SkBitmap& bitmap1, const SkBitmap& bitmap2); // Strip the accelerator char (typically '&') from a menu string. A // double accelerator char ('&&') will be converted to a single char. -std::string RemoveAcceleratorChar(const std::string& s, char accelerator_char); +UI_API std::string RemoveAcceleratorChar(const std::string& s, + char accelerator_char); } // namespace gfx; diff --git a/ui/gfx/skia_utils_gtk.h b/ui/gfx/skia_utils_gtk.h index 5682f09..f6af64c 100644 --- a/ui/gfx/skia_utils_gtk.h +++ b/ui/gfx/skia_utils_gtk.h @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 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. @@ -7,16 +7,17 @@ #pragma once #include "third_party/skia/include/core/SkColor.h" +#include "ui/ui_api.h" typedef struct _GdkColor GdkColor; namespace gfx { // Converts GdkColors to the ARGB layout Skia expects. -SkColor GdkColorToSkColor(GdkColor color); +UI_API SkColor GdkColorToSkColor(GdkColor color); // Converts ARGB to GdkColor. -GdkColor SkColorToGdkColor(SkColor color); +UI_API GdkColor SkColorToGdkColor(SkColor color); } // namespace gfx diff --git a/ui/gfx/surface/surface.gyp b/ui/gfx/surface/surface.gyp index a4e0122..17f372c 100644 --- a/ui/gfx/surface/surface.gyp +++ b/ui/gfx/surface/surface.gyp @@ -24,7 +24,7 @@ '<(DEPTH)/base/base.gyp:base', '<(DEPTH)/skia/skia.gyp:skia', '<(DEPTH)/ui/gfx/gl/gl.gyp:gl', - '<(DEPTH)/ui/ui.gyp:ui_gfx', + '<(DEPTH)/ui/ui.gyp:ui', ], 'sources': [ 'accelerated_surface_linux.cc', diff --git a/ui/gfx/transform.h b/ui/gfx/transform.h index 1482fb7..e69f196 100644 --- a/ui/gfx/transform.h +++ b/ui/gfx/transform.h @@ -7,6 +7,7 @@ #pragma once #include "third_party/skia/include/utils/SkMatrix44.h" +#include "ui/ui_api.h" namespace gfx { class Rect; @@ -18,7 +19,7 @@ namespace ui { // 4x4 transformation matrix. Transform is cheap and explicitly allows // copy/assign. -class Transform { +class UI_API Transform { public: Transform(); ~Transform(); diff --git a/ui/gfx/win_util.h b/ui/gfx/win_util.h index 3414f13..7d04f62 100644 --- a/ui/gfx/win_util.h +++ b/ui/gfx/win_util.h @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 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. @@ -6,10 +6,12 @@ #define UI_GFX_WIN_UTIL_H_ #pragma once +#include "ui/ui_api.h" + namespace gfx { // Returns true if Direct2d is available, false otherwise. -bool Direct2dIsAvailable(); +UI_API bool Direct2dIsAvailable(); // Returns true if DirectWrite is available, false otherwise. bool DirectWriteIsAvailable(); @@ -25,10 +25,396 @@ ], }, 'includes': [ - 'ui_base.gypi', - 'ui_gfx.gypi', 'ui_resources.gypi', ], + 'targets': [ + { + 'target_name': 'ui', + 'type': '<(component)', + 'dependencies': [ + '../base/base.gyp:base', + '../base/base.gyp:base_i18n', + '../base/base.gyp:base_static', + '../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations', + '../build/temp_gyp/googleurl.gyp:googleurl', + '../net/net.gyp:net', + '../skia/skia.gyp:skia', + '../third_party/icu/icu.gyp:icui18n', + '../third_party/icu/icu.gyp:icuuc', + '../third_party/libpng/libpng.gyp:libpng', + '../third_party/zlib/zlib.gyp:zlib', + 'base/strings/ui_strings.gyp:ui_strings', + 'gfx_resources', + '<(libjpeg_gyp_path):libjpeg', + ], + # Export these dependencies since text_elider.h includes ICU headers. + 'export_dependent_settings': [ + '../net/net.gyp:net', + '../third_party/icu/icu.gyp:icui18n', + '../third_party/icu/icu.gyp:icuuc', + ], + 'sources': [ + 'base/accessibility/accessibility_types.h', + 'base/accessibility/accessible_view_state.cc', + 'base/accessibility/accessible_view_state.h', + 'base/animation/animation.cc', + 'base/animation/animation.h', + 'base/animation/animation_container.cc', + 'base/animation/animation_container.h', + 'base/animation/animation_container_element.h', + 'base/animation/animation_container_observer.h', + 'base/animation/animation_delegate.h', + 'base/animation/linear_animation.cc', + 'base/animation/linear_animation.h', + 'base/animation/multi_animation.cc', + 'base/animation/multi_animation.h', + 'base/animation/slide_animation.cc', + 'base/animation/slide_animation.h', + 'base/animation/throb_animation.cc', + 'base/animation/throb_animation.h', + 'base/animation/tween.cc', + 'base/animation/tween.h', + 'base/clipboard/clipboard.cc', + 'base/clipboard/clipboard.h', + 'base/clipboard/clipboard_linux.cc', + 'base/clipboard/clipboard_mac.mm', + 'base/clipboard/clipboard_util_win.cc', + 'base/clipboard/clipboard_util_win.h', + 'base/clipboard/clipboard_win.cc', + 'base/clipboard/scoped_clipboard_writer.cc', + 'base/clipboard/scoped_clipboard_writer.h', + 'base/dragdrop/drag_drop_types_gtk.cc', + 'base/dragdrop/drag_drop_types.h', + 'base/dragdrop/drag_drop_types_win.cc', + 'base/dragdrop/drag_source.cc', + 'base/dragdrop/drag_source.h', + 'base/dragdrop/drop_target.cc', + 'base/dragdrop/drop_target.h', + 'base/dragdrop/gtk_dnd_util.cc', + 'base/dragdrop/gtk_dnd_util.h', + 'base/dragdrop/os_exchange_data.cc', + 'base/dragdrop/os_exchange_data.h', + 'base/dragdrop/os_exchange_data_provider_gtk.cc', + 'base/dragdrop/os_exchange_data_provider_gtk.h', + 'base/dragdrop/os_exchange_data_provider_win.cc', + 'base/dragdrop/os_exchange_data_provider_win.h', + 'base/events.h', + 'base/gtk/event_synthesis_gtk.cc', + 'base/gtk/event_synthesis_gtk.h', + 'base/gtk/g_object_destructor_filo.cc', + 'base/gtk/g_object_destructor_filo.h', + 'base/gtk/gtk_im_context_util.cc', + 'base/gtk/gtk_im_context_util.h', + 'base/gtk/gtk_signal.h', + 'base/gtk/gtk_signal_registrar.cc', + 'base/gtk/gtk_signal_registrar.h', + 'base/gtk/gtk_windowing.cc', + 'base/gtk/gtk_windowing.h', + 'base/ime/composition_text.cc', + 'base/ime/composition_text.h', + 'base/ime/composition_underline.h', + 'base/ime/text_input_type.h', + 'base/keycodes/keyboard_code_conversion_gtk.cc', + 'base/keycodes/keyboard_code_conversion_gtk.h', + 'base/keycodes/keyboard_code_conversion_mac.h', + 'base/keycodes/keyboard_code_conversion_mac.mm', + 'base/keycodes/keyboard_code_conversion_win.cc', + 'base/keycodes/keyboard_code_conversion_win.h', + 'base/keycodes/keyboard_code_conversion_x.cc', + 'base/keycodes/keyboard_code_conversion_x.h', + 'base/keycodes/keyboard_codes.h', + 'base/l10n/l10n_font_util.cc', + 'base/l10n/l10n_font_util.h', + 'base/l10n/l10n_util.cc', + 'base/l10n/l10n_util.h', + 'base/l10n/l10n_util_collator.h', + 'base/l10n/l10n_util_mac.h', + 'base/l10n/l10n_util_mac.mm', + 'base/l10n/l10n_util_posix.cc', + 'base/l10n/l10n_util_win.cc', + 'base/l10n/l10n_util_win.h', + 'base/message_box_flags.h', + 'base/message_box_win.cc', + 'base/message_box_win.h', + 'base/models/accelerator_cocoa.h', + 'base/models/accelerator_cocoa.mm', + 'base/models/accelerator_gtk.h', + 'base/models/accelerator.h', + 'base/models/button_menu_item_model.cc', + 'base/models/button_menu_item_model.h', + 'base/models/combobox_model.h', + 'base/models/menu_model.cc', + 'base/models/menu_model.h', + 'base/models/menu_model_delegate.h', + 'base/models/simple_menu_model.cc', + 'base/models/simple_menu_model.h', + 'base/models/table_model.cc', + 'base/models/table_model.h', + 'base/models/table_model_observer.h', + 'base/models/tree_model.cc', + 'base/models/tree_model.h', + 'base/models/tree_node_iterator.h', + 'base/models/tree_node_model.h', + 'base/range/range.cc', + 'base/range/range.h', + 'base/range/range_mac.mm', + 'base/range/range_win.cc', + 'base/resource/data_pack.cc', + 'base/resource/data_pack.h', + 'base/resource/resource_bundle.cc', + 'base/resource/resource_bundle.h', + 'base/resource/resource_bundle_linux.cc', + 'base/resource/resource_bundle_mac.mm', + 'base/resource/resource_bundle_posix.cc', + 'base/resource/resource_bundle_win.cc', + 'base/text/bytes_formatting.cc', + 'base/text/bytes_formatting.h', + 'base/text/text_elider.cc', + 'base/text/text_elider.h', + 'base/theme_provider.cc', + 'base/theme_provider.h', + 'base/ui_base_paths.cc', + 'base/ui_base_paths.h', + 'base/ui_base_switches.cc', + 'base/ui_base_switches.h', + 'base/view_prop.cc', + 'base/view_prop.h', + 'base/win/hwnd_util.cc', + 'base/win/hwnd_util.h', + 'base/win/ime_input.cc', + 'base/win/ime_input.h', + 'base/win/shell.cc', + 'base/win/shell.h', + 'base/win/window_impl.cc', + 'base/win/window_impl.h', + 'base/x/active_window_watcher_x.cc', + 'base/x/active_window_watcher_x.h', + 'base/x/x11_util.cc', + 'base/x/x11_util.h', + 'base/x/x11_util_internal.h', + 'gfx/blit.cc', + 'gfx/blit.h', + 'gfx/brush.h', + 'gfx/canvas.cc', + 'gfx/canvas.h', + 'gfx/canvas_skia.h', + 'gfx/canvas_skia.cc', + 'gfx/canvas_skia_linux.cc', + 'gfx/canvas_skia_mac.mm', + 'gfx/canvas_skia_paint.h', + 'gfx/canvas_skia_win.cc', + 'gfx/codec/jpeg_codec.cc', + 'gfx/codec/jpeg_codec.h', + 'gfx/codec/png_codec.cc', + 'gfx/codec/png_codec.h', + 'gfx/color_analysis.cc', + 'gfx/color_analysis.h', + 'gfx/color_utils.cc', + 'gfx/color_utils.h', + 'gfx/favicon_size.h', + 'gfx/font.h', + 'gfx/font.cc', + 'gfx/gfx_paths.cc', + 'gfx/gfx_paths.h', + 'gfx/image/image.cc', + 'gfx/image/image.h', + 'gfx/image/image_mac.mm', + 'gfx/image/image_util.cc', + 'gfx/image/image_util.h', + 'gfx/insets.cc', + 'gfx/insets.h', + 'gfx/interpolated_transform.h', + 'gfx/interpolated_transform.cc', + 'gfx/mac/nsimage_cache.h', + 'gfx/mac/nsimage_cache.mm', + 'gfx/mac/scoped_ns_disable_screen_updates.h', + 'gfx/native_theme.cc', + 'gfx/native_theme.h', + 'gfx/native_widget_types.h', + 'gfx/path.cc', + 'gfx/path.h', + 'gfx/path_gtk.cc', + 'gfx/path_win.cc', + 'gfx/platform_font.h', + 'gfx/platform_font_gtk.h', + 'gfx/platform_font_gtk.cc', + 'gfx/platform_font_mac.h', + 'gfx/platform_font_mac.mm', + 'gfx/platform_font_win.h', + 'gfx/platform_font_win.cc', + 'gfx/point.cc', + 'gfx/point.h', + 'gfx/rect.cc', + 'gfx/rect.h', + 'gfx/scoped_cg_context_save_gstate_mac.h', + 'gfx/scoped_ns_graphics_context_save_gstate_mac.h', + 'gfx/scoped_ns_graphics_context_save_gstate_mac.mm', + 'gfx/scrollbar_size.cc', + 'gfx/scrollbar_size.h', + 'gfx/size.cc', + 'gfx/size.h', + 'gfx/skbitmap_operations.cc', + 'gfx/skbitmap_operations.h', + 'gfx/skia_util.cc', + 'gfx/skia_util.h', + 'gfx/skia_utils_gtk.cc', + 'gfx/skia_utils_gtk.h', + 'gfx/transform.h', + 'gfx/transform.cc', + ], + 'conditions': [ + ['toolkit_uses_gtk == 1', { + 'dependencies': [ + # font_gtk.cc uses fontconfig. + # TODO(evanm): I think this is wrong; it should just use GTK. + '../build/linux/system.gyp:fontconfig', + '../build/linux/system.gyp:gtk', + '../build/linux/system.gyp:x11', + '../build/linux/system.gyp:xext', + ], + 'sources': [ + 'gfx/gtk_native_view_id_manager.cc', + 'gfx/gtk_native_view_id_manager.h', + 'gfx/gtk_preserve_window.cc', + 'gfx/gtk_preserve_window.h', + 'gfx/gtk_util.cc', + 'gfx/gtk_util.h', + 'gfx/native_theme_linux.cc', + 'gfx/native_theme_linux.h', + 'gfx/native_widget_types_gtk.cc', + ], + 'link_settings': { + 'libraries': [ + '-lXrender', # For XRender* function calls in x11_util.cc. + ], + }, + 'conditions': [ + ['toolkit_views==0', { + # Note: because of gyp predence rules this has to be defined as + # 'sources/' rather than 'sources!'. + 'sources/': [ + ['exclude', '^base/dragdrop/drag_drop_types_gtk.cc'], + ['exclude', '^base/dragdrop/os_exchange_data.cc'], + ['exclude', '^base/dragdrop/os_exchange_data.h'], + ['exclude', '^base/dragdrop/os_exchange_data_provider_gtk.cc'], + ['exclude', '^base/dragdrop/os_exchange_data_provider_gtk.h'], + ], + }, { + # Note: because of gyp predence rules this has to be defined as + # 'sources/' rather than 'sources!'. + 'sources/': [ + ['include', '^base/dragdrop/os_exchange_data.cc'], + ], + }], + ], + }], + ['OS=="win"', { + 'sources': [ + 'gfx/canvas_direct2d.cc', + 'gfx/canvas_direct2d.h', + 'gfx/gdi_util.cc', + 'gfx/gdi_util.h', + 'gfx/icon_util.cc', + 'gfx/icon_util.h', + 'gfx/native_theme_win.cc', + 'gfx/native_theme_win.h', + 'gfx/win_util.cc', + 'gfx/win_util.h', + ], + 'include_dirs': [ + '../', + '../third_party/wtl/include', + ], + 'msvs_settings': { + 'VCLinkerTool': { + 'DelayLoadDLLs': [ + 'd2d1.dll', + 'd3d10_1.dll', + ], + 'AdditionalDependencies': [ + 'd2d1.lib', + 'd3d10_1.lib', + ], + }, + }, + 'link_settings': { + 'libraries': [ + '-limm32.lib', + '-loleacc.lib', + ], + }, + },{ # OS!="win" + 'sources!': [ + 'base/dragdrop/drag_source.cc', + 'base/dragdrop/drag_source.h', + 'base/dragdrop/drag_drop_types.h', + 'base/dragdrop/drop_target.cc', + 'base/dragdrop/drop_target.h', + 'base/dragdrop/os_exchange_data.cc', + 'base/view_prop.cc', + 'base/view_prop.h', + ], + 'sources/': [ + ['exclude', '^base/win/*'], + ], + }], + ['component == "shared_library"', { + 'defines': [ + 'UI_IMPLEMENTATION', + ], + }], + ['OS=="mac"', { + 'link_settings': { + 'libraries': [ + '$(SDKROOT)/System/Library/Frameworks/Accelerate.framework', + '$(SDKROOT)/System/Library/Frameworks/AudioUnit.framework', + ], + }, + }], + ['use_x11==1', { + 'all_dependent_settings': { + 'ldflags': [ + '-L<(PRODUCT_DIR)', + ], + 'link_settings': { + 'libraries': [ + '-lX11', + '-ldl', + ], + }, + }, + }, { # use_x11==0 + 'sources!': [ + 'base/keycodes/keyboard_code_conversion_x.cc', + 'base/keycodes/keyboard_code_conversion_x.h', + ], + }], + ['chromeos==1', { + 'sources': [ + 'gfx/native_theme_chromeos.cc', + 'gfx/native_theme_chromeos.h', + ], + }], + ], + }, + { + 'target_name': 'gfx_resources', + 'type': 'none', + 'variables': { + 'grit_out_dir': '<(SHARED_INTERMEDIATE_DIR)/ui/gfx', + }, + 'actions': [ + { + 'action_name': 'gfx_resources', + 'variables': { + 'grit_grd_file': 'gfx/gfx_resources.grd', + }, + 'includes': [ '../build/grit_action.gypi' ], + }, + ], + 'includes': [ '../build/grit_target.gypi' ], + }, + ], 'conditions': [ ['toolkit_views2==1', { 'includes': [ @@ -39,6 +425,71 @@ 'includes': [ 'ui_unittests.gypi', ], + 'targets': [ + { + # TODO(rsesek): Remove this target once ui_unittests is run on the + # waterfall instead of gfx_unittests. + 'target_name': 'gfx_unittests', + 'type': 'none', + 'dependencies': [ + 'ui_unittests', + ], + 'actions': [ + { + 'message': 'TEMPORARY: Copying ui_unittests to gfx_unittests', + 'variables': { + 'ui_copy_target': '<(PRODUCT_DIR)/ui_unittests<(EXECUTABLE_SUFFIX)', + 'ui_copy_dest': '<(PRODUCT_DIR)/gfx_unittests<(EXECUTABLE_SUFFIX)', + }, + 'inputs': ['<(ui_copy_target)'], + 'outputs': ['<(ui_copy_dest)'], + 'action_name': 'TEMP_copy_ui_unittests', + 'action': [ + 'python', '-c', + 'import os, shutil; ' \ + 'shutil.copyfile(\'<(ui_copy_target)\', \'<(ui_copy_dest)\'); ' \ + 'os.chmod(\'<(ui_copy_dest)\', 0700)' + ] + } + ], + }, + ], + }], + ['OS=="win"', { + 'targets': [ + { + 'target_name': 'ui_nacl_win64', + 'type': '<(component)', + 'dependencies': [ + '../base/base.gyp:base_nacl_win64', + ], + 'defines': [ + '<@(nacl_win64_defines)', + ], + 'sources': [ + 'base/resource/resource_bundle_dummy.cc', + 'base/ui_base_paths.h', + 'base/ui_base_paths.cc', + 'base/ui_base_switches.h', + 'base/ui_base_switches.cc', + ], + 'include_dirs': [ + '..', + ], + 'configurations': { + 'Common_Base': { + 'msvs_target_platform': 'x64', + }, + }, + 'conditions': [ + ['component=="shared_library"', { + 'defines': [ + 'UI_IMPLEMENTATION', + ], + }], + ], + }, + ], }], ], } diff --git a/ui/ui_api.h b/ui/ui_api.h new file mode 100644 index 0000000..a9872f8 --- /dev/null +++ b/ui/ui_api.h @@ -0,0 +1,29 @@ +// Copyright (c) 2011 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_UI_API_H_ +#define UI_UI_API_H_ +#pragma once + +// Defines UI_API so that funtionality implemented by the UI module can be +// exported to consumers. + +#if defined(COMPONENT_BUILD) +#if defined(WIN32) + +#if defined(UI_IMPLEMENTATION) +#define UI_API __declspec(dllexport) +#else +#define UI_API __declspec(dllimport) +#endif // defined(UI_BASE_IMPLEMENTATION) + +#else // defined(WIN32) +#define UI_API __attribute__((visibility("default"))) +#endif + +#else /// defined(COMPONENT_BUILD) +#define UI_API +#endif + +#endif // UI_UI_API_H_ diff --git a/ui/ui_base.gypi b/ui/ui_base.gypi deleted file mode 100644 index b1c7061..0000000 --- a/ui/ui_base.gypi +++ /dev/null @@ -1,272 +0,0 @@ -# Copyright (c) 2011 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. - -{ - 'targets': [ - { - 'target_name': 'ui_base', - 'type': 'static_library', - 'dependencies': [ - '../base/base.gyp:base', - '../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations', - '../build/temp_gyp/googleurl.gyp:googleurl', - '../net/net.gyp:net', - '../skia/skia.gyp:skia', - '../third_party/icu/icu.gyp:icui18n', - '../third_party/icu/icu.gyp:icuuc', - 'base/strings/ui_strings.gyp:ui_strings', - 'ui_gfx', - ], - # Export these dependencies since text_elider.h includes ICU headers. - 'export_dependent_settings': [ - '../net/net.gyp:net', - '../third_party/icu/icu.gyp:icui18n', - '../third_party/icu/icu.gyp:icuuc', - ], - 'sources': [ - 'base/accessibility/accessibility_types.h', - 'base/accessibility/accessible_view_state.cc', - 'base/accessibility/accessible_view_state.h', - 'base/animation/animation.cc', - 'base/animation/animation.h', - 'base/animation/animation_container.cc', - 'base/animation/animation_container.h', - 'base/animation/animation_container_element.h', - 'base/animation/animation_container_observer.h', - 'base/animation/animation_delegate.h', - 'base/animation/linear_animation.cc', - 'base/animation/linear_animation.h', - 'base/animation/multi_animation.cc', - 'base/animation/multi_animation.h', - 'base/animation/slide_animation.cc', - 'base/animation/slide_animation.h', - 'base/animation/throb_animation.cc', - 'base/animation/throb_animation.h', - 'base/animation/tween.cc', - 'base/animation/tween.h', - 'base/clipboard/clipboard.cc', - 'base/clipboard/clipboard.h', - 'base/clipboard/clipboard_linux.cc', - 'base/clipboard/clipboard_mac.mm', - 'base/clipboard/clipboard_util_win.cc', - 'base/clipboard/clipboard_util_win.h', - 'base/clipboard/clipboard_win.cc', - 'base/clipboard/scoped_clipboard_writer.cc', - 'base/clipboard/scoped_clipboard_writer.h', - 'base/dragdrop/drag_drop_types_gtk.cc', - 'base/dragdrop/drag_drop_types.h', - 'base/dragdrop/drag_drop_types_win.cc', - 'base/dragdrop/drag_source.cc', - 'base/dragdrop/drag_source.h', - 'base/dragdrop/drop_target.cc', - 'base/dragdrop/drop_target.h', - 'base/dragdrop/gtk_dnd_util.cc', - 'base/dragdrop/gtk_dnd_util.h', - 'base/dragdrop/os_exchange_data.cc', - 'base/dragdrop/os_exchange_data.h', - 'base/dragdrop/os_exchange_data_provider_gtk.cc', - 'base/dragdrop/os_exchange_data_provider_gtk.h', - 'base/dragdrop/os_exchange_data_provider_win.cc', - 'base/dragdrop/os_exchange_data_provider_win.h', - 'base/events.h', - 'base/gtk/event_synthesis_gtk.cc', - 'base/gtk/event_synthesis_gtk.h', - 'base/gtk/g_object_destructor_filo.cc', - 'base/gtk/g_object_destructor_filo.h', - 'base/gtk/gtk_im_context_util.cc', - 'base/gtk/gtk_im_context_util.h', - 'base/gtk/gtk_signal.h', - 'base/gtk/gtk_signal_registrar.cc', - 'base/gtk/gtk_signal_registrar.h', - 'base/gtk/gtk_windowing.cc', - 'base/gtk/gtk_windowing.h', - 'base/ime/composition_text.cc', - 'base/ime/composition_text.h', - 'base/ime/composition_underline.h', - 'base/ime/text_input_type.h', - 'base/keycodes/keyboard_code_conversion_gtk.cc', - 'base/keycodes/keyboard_code_conversion_gtk.h', - 'base/keycodes/keyboard_code_conversion_mac.h', - 'base/keycodes/keyboard_code_conversion_mac.mm', - 'base/keycodes/keyboard_code_conversion_win.cc', - 'base/keycodes/keyboard_code_conversion_win.h', - 'base/keycodes/keyboard_code_conversion_x.cc', - 'base/keycodes/keyboard_code_conversion_x.h', - 'base/keycodes/keyboard_codes.h', - 'base/l10n/l10n_font_util.cc', - 'base/l10n/l10n_font_util.h', - 'base/l10n/l10n_util.cc', - 'base/l10n/l10n_util.h', - 'base/l10n/l10n_util_collator.h', - 'base/l10n/l10n_util_mac.h', - 'base/l10n/l10n_util_mac.mm', - 'base/l10n/l10n_util_posix.cc', - 'base/l10n/l10n_util_win.cc', - 'base/l10n/l10n_util_win.h', - 'base/message_box_flags.h', - 'base/message_box_win.cc', - 'base/message_box_win.h', - 'base/models/accelerator_cocoa.h', - 'base/models/accelerator_cocoa.mm', - 'base/models/accelerator_gtk.h', - 'base/models/accelerator.h', - 'base/models/button_menu_item_model.cc', - 'base/models/button_menu_item_model.h', - 'base/models/combobox_model.h', - 'base/models/menu_model.cc', - 'base/models/menu_model.h', - 'base/models/menu_model_delegate.h', - 'base/models/simple_menu_model.cc', - 'base/models/simple_menu_model.h', - 'base/models/table_model.cc', - 'base/models/table_model.h', - 'base/models/table_model_observer.h', - 'base/models/tree_model.cc', - 'base/models/tree_model.h', - 'base/models/tree_node_iterator.h', - 'base/models/tree_node_model.h', - 'base/range/range.cc', - 'base/range/range.h', - 'base/range/range_mac.mm', - 'base/range/range_win.cc', - 'base/resource/data_pack.cc', - 'base/resource/data_pack.h', - 'base/resource/resource_bundle.cc', - 'base/resource/resource_bundle.h', - 'base/resource/resource_bundle_linux.cc', - 'base/resource/resource_bundle_mac.mm', - 'base/resource/resource_bundle_posix.cc', - 'base/resource/resource_bundle_win.cc', - 'base/text/bytes_formatting.cc', - 'base/text/bytes_formatting.h', - 'base/text/text_elider.cc', - 'base/text/text_elider.h', - 'base/theme_provider.cc', - 'base/theme_provider.h', - 'base/ui_base_paths.cc', - 'base/ui_base_paths.h', - 'base/ui_base_switches.cc', - 'base/ui_base_switches.h', - 'base/view_prop.cc', - 'base/view_prop.h', - 'base/win/hwnd_util.cc', - 'base/win/hwnd_util.h', - 'base/win/ime_input.cc', - 'base/win/ime_input.h', - 'base/win/shell.cc', - 'base/win/shell.h', - 'base/win/window_impl.cc', - 'base/win/window_impl.h', - 'base/x/active_window_watcher_x.cc', - 'base/x/active_window_watcher_x.h', - 'base/x/x11_util.cc', - 'base/x/x11_util.h', - 'base/x/x11_util_internal.h', - ], - 'conditions': [ - ['toolkit_uses_gtk == 1', { - 'dependencies': [ - '../build/linux/system.gyp:fontconfig', - '../build/linux/system.gyp:gtk', - '../build/linux/system.gyp:x11', - '../build/linux/system.gyp:xext', - ], - 'link_settings': { - 'libraries': [ - '-lXrender', # For XRender* function calls in x11_util.cc. - ], - }, - 'conditions': [ - ['toolkit_views==0', { - # Note: because of gyp predence rules this has to be defined as - # 'sources/' rather than 'sources!'. - 'sources/': [ - ['exclude', '^base/dragdrop/drag_drop_types_gtk.cc'], - ['exclude', '^base/dragdrop/os_exchange_data.cc'], - ['exclude', '^base/dragdrop/os_exchange_data.h'], - ['exclude', '^base/dragdrop/os_exchange_data_provider_gtk.cc'], - ['exclude', '^base/dragdrop/os_exchange_data_provider_gtk.h'], - ], - }, { - # Note: because of gyp predence rules this has to be defined as - # 'sources/' rather than 'sources!'. - 'sources/': [ - ['include', '^base/dragdrop/os_exchange_data.cc'], - ], - }], - ], - }], - ['OS!="win"', { - 'sources!': [ - 'base/dragdrop/drag_source.cc', - 'base/dragdrop/drag_source.h', - 'base/dragdrop/drag_drop_types.h', - 'base/dragdrop/drop_target.cc', - 'base/dragdrop/drop_target.h', - 'base/dragdrop/os_exchange_data.cc', - 'base/view_prop.cc', - 'base/view_prop.h', - ], - 'sources/': [ - ['exclude', '^base/win/*'], - ], - }], - ['OS=="mac"', { - 'link_settings': { - 'libraries': [ - '$(SDKROOT)/System/Library/Frameworks/Accelerate.framework', - '$(SDKROOT)/System/Library/Frameworks/AudioUnit.framework', - ], - }, - }], - ['use_x11==1', { - 'all_dependent_settings': { - 'ldflags': [ - '-L<(PRODUCT_DIR)', - ], - 'link_settings': { - 'libraries': [ - '-lX11', - '-ldl', - ], - }, - }, - }, { # use_x11==0 - 'sources!': [ - 'base/keycodes/keyboard_code_conversion_x.cc', - 'base/keycodes/keyboard_code_conversion_x.h', - ], - }], - ], - }, - ], - 'conditions': [ - ['OS=="win"', { - 'targets': [ - { - 'target_name': 'ui_base_nacl_win64', - 'type': 'static_library', - 'defines': [ - '<@(nacl_win64_defines)', - ], - 'sources': [ - 'base/resource/resource_bundle_dummy.cc', - 'base/ui_base_paths.h', - 'base/ui_base_paths.cc', - 'base/ui_base_switches.h', - 'base/ui_base_switches.cc', - ], - 'include_dirs': [ - '..', - ], - 'configurations': { - 'Common_Base': { - 'msvs_target_platform': 'x64', - }, - }, - }, - ], - }], - ], -} diff --git a/ui/ui_gfx.gypi b/ui/ui_gfx.gypi deleted file mode 100644 index 1b074cf..0000000 --- a/ui/ui_gfx.gypi +++ /dev/null @@ -1,192 +0,0 @@ -# Copyright (c) 2011 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. - -{ - 'targets': [ - { - # TODO(rsesek): Remove this target once ui_unittests is run on the - # waterfall instead of gfx_unittests. - 'target_name': 'gfx_unittests', - 'type': 'none', - 'conditions': [ - ['inside_chromium_build==1', { - 'dependencies': [ - 'ui_unittests', - ], - }], - ], - 'actions': [ - { - 'message': 'TEMPORARY: Copying ui_unittests to gfx_unittests', - 'variables': { - 'ui_copy_target': '<(PRODUCT_DIR)/ui_unittests<(EXECUTABLE_SUFFIX)', - 'ui_copy_dest': '<(PRODUCT_DIR)/gfx_unittests<(EXECUTABLE_SUFFIX)', - }, - 'inputs': ['<(ui_copy_target)'], - 'outputs': ['<(ui_copy_dest)'], - 'action_name': 'TEMP_copy_ui_unittests', - 'action': [ - 'python', '-c', - 'import os, shutil; ' \ - 'shutil.copyfile(\'<(ui_copy_target)\', \'<(ui_copy_dest)\'); ' \ - 'os.chmod(\'<(ui_copy_dest)\', 0700)' - ] - } - ], - }, - { - 'target_name': 'ui_gfx', - 'type': 'static_library', - 'dependencies': [ - '../base/base.gyp:base', - '../base/base.gyp:base_i18n', - '../skia/skia.gyp:skia', - '../third_party/icu/icu.gyp:icui18n', - '../third_party/icu/icu.gyp:icuuc', - '../third_party/libpng/libpng.gyp:libpng', - '../third_party/zlib/zlib.gyp:zlib', - 'gfx_resources', - '<(libjpeg_gyp_path):libjpeg', - ], - 'sources': [ - 'gfx/blit.cc', - 'gfx/blit.h', - 'gfx/brush.h', - 'gfx/canvas.cc', - 'gfx/canvas.h', - 'gfx/canvas_skia.h', - 'gfx/canvas_skia.cc', - 'gfx/canvas_skia_linux.cc', - 'gfx/canvas_skia_mac.mm', - 'gfx/canvas_skia_paint.h', - 'gfx/canvas_skia_win.cc', - 'gfx/codec/jpeg_codec.cc', - 'gfx/codec/jpeg_codec.h', - 'gfx/codec/png_codec.cc', - 'gfx/codec/png_codec.h', - 'gfx/color_analysis.cc', - 'gfx/color_analysis.h', - 'gfx/color_utils.cc', - 'gfx/color_utils.h', - 'gfx/favicon_size.h', - 'gfx/font.h', - 'gfx/font.cc', - 'gfx/gfx_paths.cc', - 'gfx/gfx_paths.h', - 'gfx/image/image.cc', - 'gfx/image/image.h', - 'gfx/image/image_mac.mm', - 'gfx/image/image_util.cc', - 'gfx/image/image_util.h', - 'gfx/insets.cc', - 'gfx/insets.h', - 'gfx/interpolated_transform.h', - 'gfx/interpolated_transform.cc', - 'gfx/mac/nsimage_cache.h', - 'gfx/mac/nsimage_cache.mm', - 'gfx/mac/scoped_ns_disable_screen_updates.h', - 'gfx/native_theme.cc', - 'gfx/native_theme.h', - 'gfx/native_widget_types.h', - 'gfx/path.cc', - 'gfx/path.h', - 'gfx/path_gtk.cc', - 'gfx/path_win.cc', - 'gfx/platform_font.h', - 'gfx/platform_font_gtk.h', - 'gfx/platform_font_gtk.cc', - 'gfx/platform_font_mac.h', - 'gfx/platform_font_mac.mm', - 'gfx/platform_font_win.h', - 'gfx/platform_font_win.cc', - 'gfx/point.cc', - 'gfx/point.h', - 'gfx/rect.cc', - 'gfx/rect.h', - 'gfx/scoped_cg_context_save_gstate_mac.h', - 'gfx/scoped_ns_graphics_context_save_gstate_mac.h', - 'gfx/scoped_ns_graphics_context_save_gstate_mac.mm', - 'gfx/scrollbar_size.cc', - 'gfx/scrollbar_size.h', - 'gfx/size.cc', - 'gfx/size.h', - 'gfx/skbitmap_operations.cc', - 'gfx/skbitmap_operations.h', - 'gfx/skia_util.cc', - 'gfx/skia_util.h', - 'gfx/skia_utils_gtk.cc', - 'gfx/skia_utils_gtk.h', - ], - 'conditions': [ - ['OS!="mac"', { - 'sources': [ - 'gfx/transform.h', - 'gfx/transform.cc', - ], - }], - ['OS=="win"', { - 'sources': [ - 'gfx/canvas_direct2d.cc', - 'gfx/canvas_direct2d.h', - 'gfx/gdi_util.cc', - 'gfx/gdi_util.h', - 'gfx/icon_util.cc', - 'gfx/icon_util.h', - 'gfx/native_theme_win.cc', - 'gfx/native_theme_win.h', - 'gfx/win_util.cc', - 'gfx/win_util.h', - ], - 'include_dirs': [ - '../', - '../third_party/wtl/include', - ], - }], - ['toolkit_uses_gtk == 1', { - 'dependencies': [ - # font_gtk.cc uses fontconfig. - # TODO(evanm): I think this is wrong; it should just use GTK. - '../build/linux/system.gyp:fontconfig', - '../build/linux/system.gyp:gtk', - ], - 'sources': [ - 'gfx/gtk_native_view_id_manager.cc', - 'gfx/gtk_native_view_id_manager.h', - 'gfx/gtk_preserve_window.cc', - 'gfx/gtk_preserve_window.h', - 'gfx/gtk_util.cc', - 'gfx/gtk_util.h', - 'gfx/native_theme_linux.cc', - 'gfx/native_theme_linux.h', - 'gfx/native_widget_types_gtk.cc', - ], - }], - ['chromeos==1', { - 'sources': [ - 'gfx/native_theme_chromeos.cc', - 'gfx/native_theme_chromeos.h', - ], - }], - ], - }, - { - 'target_name': 'gfx_resources', - 'type': 'none', - 'variables': { - 'grit_out_dir': '<(SHARED_INTERMEDIATE_DIR)/ui/gfx', - }, - 'actions': [ - { - 'action_name': 'gfx_resources', - 'variables': { - 'grit_grd_file': 'gfx/gfx_resources.grd', - }, - 'includes': [ '../build/grit_action.gypi' ], - }, - ], - 'includes': [ '../build/grit_target.gypi' ], - }, - - ], -} diff --git a/ui/ui_unittests.gypi b/ui/ui_unittests.gypi index 322d153..5c7f9b7 100644 --- a/ui/ui_unittests.gypi +++ b/ui/ui_unittests.gypi @@ -10,11 +10,11 @@ 'dependencies': [ '../base/base.gyp:base', '../base/base.gyp:test_support_base', + '../build/temp_gyp/googleurl.gyp:googleurl', '../skia/skia.gyp:skia', '../testing/gmock.gyp:gmock', '../testing/gtest.gyp:gtest', - 'ui_base', - 'ui_gfx', + 'ui', 'gfx_resources', ], 'sources': [ diff --git a/ui/ui_views.gypi b/ui/ui_views.gypi index d76eebe..e901918 100644 --- a/ui/ui_views.gypi +++ b/ui/ui_views.gypi @@ -10,7 +10,7 @@ 'dependencies': [ '../skia/skia.gyp:skia', '../ui/base/strings/ui_strings.gyp:ui_strings', - 'ui_gfx', + 'ui', ], 'sources': [ 'views/events/accelerator.cc', diff --git a/views/views.gyp b/views/views.gyp index 8441f37..c2b9920 100644 --- a/views/views.gyp +++ b/views/views.gyp @@ -44,6 +44,7 @@ 'type': 'static_library', 'dependencies': [ '../base/base.gyp:base', + '../base/base.gyp:base_i18n', '../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations', '../build/temp_gyp/googleurl.gyp:googleurl', '../skia/skia.gyp:skia', @@ -51,7 +52,7 @@ '../third_party/icu/icu.gyp:icuuc', '../ui/base/strings/ui_strings.gyp:ui_strings', '../ui/gfx/compositor/compositor.gyp:compositor', - '../ui/ui.gyp:ui_base', + '../ui/ui.gyp:ui', '../ui/ui.gyp:ui_resources', ], 'sources': [ @@ -66,7 +67,7 @@ 'background.h', 'border.cc', 'border.h', - 'context_menu_controller.h', + 'context_menu_controller.h', 'controls/button/button.cc', 'controls/button/button.h', 'controls/button/button_dropdown.cc', @@ -548,7 +549,7 @@ '../skia/skia.gyp:skia', '../third_party/icu/icu.gyp:icui18n', '../third_party/icu/icu.gyp:icuuc', - '../ui/ui.gyp:ui_gfx', + '../ui/ui.gyp:ui', '../ui/ui.gyp:gfx_resources', '../ui/ui.gyp:ui_resources', 'views', @@ -639,7 +640,7 @@ '../third_party/icu/icu.gyp:icui18n', '../third_party/icu/icu.gyp:icuuc', '../ui/ui.gyp:gfx_resources', - '../ui/ui.gyp:ui_gfx', + '../ui/ui.gyp:ui', '../ui/ui.gyp:ui_resources', 'views', ], @@ -691,7 +692,7 @@ '../third_party/icu/icu.gyp:icui18n', '../third_party/icu/icu.gyp:icuuc', '../ui/ui.gyp:gfx_resources', - '../ui/ui.gyp:ui_gfx', + '../ui/ui.gyp:ui', '../ui/ui.gyp:ui_resources', 'views', 'views_desktop_lib', diff --git a/webkit/support/webkit_support.gypi b/webkit/support/webkit_support.gypi index 2fe15e1..bfa4774 100644 --- a/webkit/support/webkit_support.gypi +++ b/webkit/support/webkit_support.gypi @@ -16,7 +16,7 @@ '<(DEPTH)/net/net.gyp:net', '<(DEPTH)/skia/skia.gyp:skia', '<(DEPTH)/testing/gtest.gyp:gtest', - '<(DEPTH)/ui/ui.gyp:ui_gfx', + '<(DEPTH)/ui/ui.gyp:ui', 'appcache', 'blob', 'database', @@ -46,7 +46,6 @@ 'test_webplugin_page_delegate.h', 'webkit_support.cc', 'webkit_support.h', - 'webkit_support_gfx.h', 'webkit_support_glue.cc', 'weburl_loader_mock.cc', 'weburl_loader_mock.h', @@ -81,7 +80,7 @@ '<(DEPTH)/crypto/crypto.gyp:crypto', '<(DEPTH)/net/net.gyp:net', '<(DEPTH)/skia/skia.gyp:skia', - '<(DEPTH)/ui/ui.gyp:ui_base', + '<(DEPTH)/ui/ui.gyp:ui', 'glue', ], 'export_dependent_settings': [ @@ -113,6 +112,8 @@ '<(DEPTH)/webkit/tools/test_shell/test_shell_webmimeregistry_impl.h', 'simple_database_system.cc', 'simple_database_system.h', + 'webkit_support_gfx.h', + 'webkit_support_gfx.cc', ], 'conditions': [ ['inside_chromium_build==0', { diff --git a/webkit/support/webkit_support_gfx.cc b/webkit/support/webkit_support_gfx.cc new file mode 100644 index 0000000..ecf788d --- /dev/null +++ b/webkit/support/webkit_support_gfx.cc @@ -0,0 +1,57 @@ +// Copyright (c) 2011 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 "webkit/support/webkit_support_gfx.h" + +#include "ui/gfx/codec/png_codec.h" +#include "ui/gfx/size.h" + +namespace webkit_support { + +// Decode a PNG into an RGBA pixel array. +bool DecodePNG(const unsigned char* input, size_t input_size, + std::vector<unsigned char>* output, + int* width, int* height) { + return gfx::PNGCodec::Decode(input, input_size, gfx::PNGCodec::FORMAT_RGBA, + output, width, height); +} + +// Encode an RGBA pixel array into a PNG. +bool EncodeRGBAPNG(const unsigned char* input, + int width, + int height, + int row_byte_width, + std::vector<unsigned char>* output) { + return gfx::PNGCodec::Encode(input, gfx::PNGCodec::FORMAT_RGBA, + gfx::Size(width, height), row_byte_width, false, + std::vector<gfx::PNGCodec::Comment>(), output); +} + +// Encode an BGRA pixel array into a PNG. +bool EncodeBGRAPNG(const unsigned char* input, + int width, + int height, + int row_byte_width, + bool discard_transparency, + std::vector<unsigned char>* output) { + return gfx::PNGCodec::Encode(input, gfx::PNGCodec::FORMAT_BGRA, + gfx::Size(width, height), row_byte_width, discard_transparency, + std::vector<gfx::PNGCodec::Comment>(), output); +} + +bool EncodeBGRAPNGWithChecksum(const unsigned char* input, + int width, + int height, + int row_byte_width, + bool discard_transparency, + const std::string& checksum, + std::vector<unsigned char>* output) { + std::vector<gfx::PNGCodec::Comment> comments; + comments.push_back(gfx::PNGCodec::Comment("checksum", checksum)); + return gfx::PNGCodec::Encode(input, gfx::PNGCodec::FORMAT_BGRA, + gfx::Size(width, height), row_byte_width, discard_transparency, + comments, output); +} + +} // namespace webkit_support diff --git a/webkit/support/webkit_support_gfx.h b/webkit/support/webkit_support_gfx.h index e652d1c..d832fcc 100644 --- a/webkit/support/webkit_support_gfx.h +++ b/webkit/support/webkit_support_gfx.h @@ -8,55 +8,39 @@ #include <string> #include <vector> -#include "ui/gfx/codec/png_codec.h" -#include "ui/gfx/size.h" +// TODO(darin): Remove once this #include has been upstreamed to ImageDiff.cpp. +// ImageDiff.cpp expects that PATH_MAX has already been defined :-/ +#include <limits.h> namespace webkit_support { // Decode a PNG into an RGBA pixel array. -inline bool DecodePNG(const unsigned char* input, size_t input_size, - std::vector<unsigned char>* output, - int* width, int* height) { - return gfx::PNGCodec::Decode(input, input_size, gfx::PNGCodec::FORMAT_RGBA, - output, width, height); -} +bool DecodePNG(const unsigned char* input, size_t input_size, + std::vector<unsigned char>* output, + int* width, int* height); // Encode an RGBA pixel array into a PNG. -inline bool EncodeRGBAPNG(const unsigned char* input, - int width, - int height, - int row_byte_width, - std::vector<unsigned char>* output) { - return gfx::PNGCodec::Encode(input, gfx::PNGCodec::FORMAT_RGBA, - gfx::Size(width, height), row_byte_width, false, - std::vector<gfx::PNGCodec::Comment>(), output); -} +bool EncodeRGBAPNG(const unsigned char* input, + int width, + int height, + int row_byte_width, + std::vector<unsigned char>* output); // Encode an BGRA pixel array into a PNG. -inline bool EncodeBGRAPNG(const unsigned char* input, - int width, - int height, - int row_byte_width, - bool discard_transparency, - std::vector<unsigned char>* output) { - return gfx::PNGCodec::Encode(input, gfx::PNGCodec::FORMAT_BGRA, - gfx::Size(width, height), row_byte_width, discard_transparency, - std::vector<gfx::PNGCodec::Comment>(), output); -} - -inline bool EncodeBGRAPNGWithChecksum(const unsigned char* input, - int width, - int height, - int row_byte_width, - bool discard_transparency, - const std::string& checksum, - std::vector<unsigned char>* output) { - std::vector<gfx::PNGCodec::Comment> comments; - comments.push_back(gfx::PNGCodec::Comment("checksum", checksum)); - return gfx::PNGCodec::Encode(input, gfx::PNGCodec::FORMAT_BGRA, - gfx::Size(width, height), row_byte_width, discard_transparency, - comments, output); -} +bool EncodeBGRAPNG(const unsigned char* input, + int width, + int height, + int row_byte_width, + bool discard_transparency, + std::vector<unsigned char>* output); + +bool EncodeBGRAPNGWithChecksum(const unsigned char* input, + int width, + int height, + int row_byte_width, + bool discard_transparency, + const std::string& checksum, + std::vector<unsigned char>* output); } // namespace webkit_support |