diff options
-rw-r--r-- | chrome/SConscript | 5 | ||||
-rw-r--r-- | chrome/views/SConscript | 145 | ||||
-rw-r--r-- | chrome/views/accelerator.h | 2 | ||||
-rw-r--r-- | chrome/views/background.h | 13 | ||||
-rw-r--r-- | chrome/views/grid_layout.cc | 10 | ||||
-rw-r--r-- | chrome/views/image_view.h | 2 | ||||
-rw-r--r-- | chrome/views/layout_manager.h | 4 | ||||
-rw-r--r-- | chrome/views/view.h | 12 |
8 files changed, 168 insertions, 25 deletions
diff --git a/chrome/SConscript b/chrome/SConscript index fefd331..f76bb3d 100644 --- a/chrome/SConscript +++ b/chrome/SConscript @@ -430,7 +430,9 @@ if env_flat.Bit('windows'): # determines implicit dependencies from .rc files. env_flat.Depends(browser_res, flats_out) -sconscript_files = [] +sconscript_files = [ + 'views/SConscript', +] if not env.WantSystemLib('hunspell'): sconscript_files.append('third_party/hunspell/SConscript') @@ -443,7 +445,6 @@ if env.Bit('windows'): 'app/resources/SConscript', 'app/theme/SConscript', 'browser/views/SConscript', - 'views/SConscript', ]) env.SConscript(sconscript_files, exports=['env', 'env_res', 'env_test']) diff --git a/chrome/views/SConscript b/chrome/views/SConscript index 1c9779a..7e4596a 100644 --- a/chrome/views/SConscript +++ b/chrome/views/SConscript @@ -6,17 +6,17 @@ Import('env') env = env.Clone() - -env.Prepend( - CPPPATH = [ - '$CHROME_DIR/tools/build/win', - '$CHROME_SRC_DIR', - ], - CCFLAGS = [ - '/TP', - #'/Wp64', - ], -) +if env.Bit('windows'): + env.Prepend( + CPPPATH = [ + '$CHROME_DIR/tools/build/win', + '$CHROME_SRC_DIR', + ], + CCFLAGS = [ + '/TP', + #'/Wp64', + ], + ) env.Append( CPPPATH = [ @@ -92,6 +92,129 @@ input_files = [ 'window_delegate.cc', ] +if env.Bit('linux'): + # TODO(port): Port to Linux. + remove_files = [ + 'accelerator.cc', + 'accelerator_handler.cc', + 'accessibility/accessible_wrapper.cc', + 'accessibility/view_accessibility.cc', + 'aero_tooltip_manager.cc', + 'background.cc', + 'base_button.cc', + 'bitmap_scroll_bar.cc', + 'button.cc', + 'button_dropdown.cc', + 'checkbox.cc', + 'chrome_menu.cc', + 'client_view.cc', + 'combo_box.cc', + 'custom_frame_window.cc', + 'dialog_delegate.cc', + 'dialog_client_view.cc', + 'decision.cc', + 'event.cc', + 'external_focus_tracker.cc', + 'focus_manager.cc', + 'group_table_view.cc', + 'hwnd_view.cc', + 'label.cc', + 'link.cc', + 'menu.cc', + 'menu_button.cc', + 'message_box_view.cc', + 'native_button.cc', + 'native_control.cc', + 'native_scroll_bar.cc', + 'non_client_view.cc', + 'painter.cc', + 'radio_button.cc', + 'resize_corner.cc', + 'root_view.cc', + 'root_view_drop_target.cc', + 'scroll_view.cc', + 'separator.cc', + 'single_split_view.cc', + 'tabbed_pane.cc', + 'table_view.cc', + 'text_button.cc', + 'text_field.cc', + 'throbber.cc', + 'tooltip_manager.cc', + 'tree_view.cc', + 'view.cc', + 'widget_win.cc', + 'window.cc', + 'window_delegate.cc', + ] + for file in remove_files: + input_files.remove(file) + +if env.Bit('mac'): + # TODO(port): Port to Mac. + remove_files = [ + 'accelerator.cc', + 'accelerator_handler.cc', + 'accessibility/accessible_wrapper.cc', + 'accessibility/view_accessibility.cc', + 'aero_tooltip_manager.cc', + 'background.cc', + 'base_button.cc', + 'bitmap_scroll_bar.cc', + 'border.cc', + 'button.cc', + 'button_dropdown.cc', + 'checkbox.cc', + 'chrome_menu.cc', + 'client_view.cc', + 'combo_box.cc', + 'custom_frame_window.cc', + 'dialog_delegate.cc', + 'dialog_client_view.cc', + 'decision.cc', + 'event.cc', + 'external_focus_tracker.cc', + 'focus_manager.cc', + 'grid_layout.cc', + 'group_table_view.cc', + 'hwnd_view.cc', + 'image_view.cc', + 'label.cc', + 'layout_manager.cc', + 'link.cc', + 'menu.cc', + 'menu_button.cc', + 'message_box_view.cc', + 'native_button.cc', + 'native_control.cc', + 'native_scroll_bar.cc', + 'non_client_view.cc', + 'painter.cc', + 'radio_button.cc', + 'repeat_controller.cc', + 'resize_corner.cc', + 'root_view.cc', + 'root_view_drop_target.cc', + 'scroll_bar.cc', + 'scroll_view.cc', + 'separator.cc', + 'single_split_view.cc', + 'tabbed_pane.cc', + 'table_view.cc', + 'text_button.cc', + 'text_field.cc', + 'throbber.cc', + 'tooltip_manager.cc', + 'tree_view.cc', + 'view.cc', + 'view_storage.cc', + 'widget_win.cc', + 'window.cc', + 'window_delegate.cc', + ] + for file in remove_files: + input_files.remove(file) + env.ChromeLibrary('views', input_files) env.ChromeMSVSProject('$CHROME_DIR/views/views.vcproj', diff --git a/chrome/views/accelerator.h b/chrome/views/accelerator.h index 2bf8253..44f0acf 100644 --- a/chrome/views/accelerator.h +++ b/chrome/views/accelerator.h @@ -38,7 +38,7 @@ class Accelerator { ~Accelerator() { }; - Accelerator& Accelerator::operator=(const Accelerator& accelerator) { + Accelerator& operator=(const Accelerator& accelerator) { if (this != &accelerator) { key_code_ = accelerator.key_code_; modifiers_ = accelerator.modifiers_; diff --git a/chrome/views/background.h b/chrome/views/background.h index 2255d50..1169dac 100644 --- a/chrome/views/background.h +++ b/chrome/views/background.h @@ -5,7 +5,11 @@ #ifndef CHROME_VIEWS_BACKGROUND_H__ #define CHROME_VIEWS_BACKGROUND_H__ +#include "build/build_config.h" + +#if defined(OS_WIN) #include <windows.h> +#endif // defined(OS_WIN) #include "base/basictypes.h" #include "SkColor.h" @@ -67,12 +71,19 @@ class Background { // controls. Unfortunately alpha=0 is not an option. void SetNativeControlColor(SkColor color); +#if defined(OS_WIN) + // TODO(port): Make GetNativeControlBrush portable (currently uses HBRUSH). + // Get the brush that was specified by SetNativeControlColor HBRUSH GetNativeControlBrush() const { return native_control_brush_; }; +#endif // defined(OS_WIN) private: +#if defined(OS_WIN) + // TODO(port): Create portable replacement for HBRUSH. HBRUSH native_control_brush_; - DISALLOW_EVIL_CONSTRUCTORS(Background); +#endif // defined(OS_WIN) + DISALLOW_COPY_AND_ASSIGN(Background); }; } // namespace views diff --git a/chrome/views/grid_layout.cc b/chrome/views/grid_layout.cc index fd36e61..95a3a86 100644 --- a/chrome/views/grid_layout.cc +++ b/chrome/views/grid_layout.cc @@ -21,7 +21,7 @@ class LayoutElement { template <class T> static void ResetSizes(std::vector<T*>* elements) { // Reset the layout width of each column. - for (std::vector<T*>::iterator i = elements->begin(); + for (typename std::vector<T*>::iterator i = elements->begin(); i != elements->end(); ++i) { (*i)->ResetSize(); } @@ -33,7 +33,7 @@ class LayoutElement { static void CalculateLocationsFromSize(std::vector<T*>* elements) { // Reset the layout width of each column. int location = 0; - for (std::vector<T*>::iterator i = elements->begin(); + for (typename std::vector<T*>::iterator i = elements->begin(); i != elements->end(); ++i) { (*i)->SetLocation(location); location += (*i)->Size(); @@ -50,7 +50,7 @@ class LayoutElement { float total_percent = 0; int resize_count = 0; - for (std::vector<T*>::iterator i = elements->begin(); + for (typename std::vector<T*>::iterator i = elements->begin(); i != elements->end(); ++i) { total_percent += (*i)->ResizePercent(); resize_count++; @@ -61,7 +61,7 @@ class LayoutElement { } int remaining = delta; int resized = resize_count; - for (std::vector<T*>::iterator i = elements->begin(); + for (typename std::vector<T*>::iterator i = elements->begin(); i != elements->end(); ++i) { T* element = *i; if (element->ResizePercent() > 0) { @@ -317,8 +317,8 @@ struct ViewState { View* const view; const int start_col; const int start_row; - const int row_span; const int col_span; + const int row_span; const GridLayout::Alignment h_align; const GridLayout::Alignment v_align; diff --git a/chrome/views/image_view.h b/chrome/views/image_view.h index d0ba89b..0632d5d 100644 --- a/chrome/views/image_view.h +++ b/chrome/views/image_view.h @@ -5,8 +5,6 @@ #ifndef CHROME_VIEWS_IMAGE_VIEW_H__ #define CHROME_VIEWS_IMAGE_VIEW_H__ -#include <windows.h> - #include "chrome/views/view.h" #include "SkBitmap.h" diff --git a/chrome/views/layout_manager.h b/chrome/views/layout_manager.h index 81bfdbc..fbe5a13 100644 --- a/chrome/views/layout_manager.h +++ b/chrome/views/layout_manager.h @@ -5,9 +5,7 @@ #ifndef CHROME_VIEWS_LAYOUT_MANAGER_H__ #define CHROME_VIEWS_LAYOUT_MANAGER_H__ -#include <atlbase.h> -#include <atlapp.h> -#include <atlmisc.h> +#include "chrome/views/view.h" namespace gfx { class Size; diff --git a/chrome/views/view.h b/chrome/views/view.h index 383473f..a3ecc68 100644 --- a/chrome/views/view.h +++ b/chrome/views/view.h @@ -5,9 +5,13 @@ #ifndef CHROME_VIEWS_VIEW_H_ #define CHROME_VIEWS_VIEW_H_ +#include "build/build_config.h" + +#if defined(OS_WIN) #include <atlbase.h> #include <atlapp.h> #include <atlmisc.h> +#endif // defined(OS_WIN) #include <map> #include <vector> @@ -554,6 +558,9 @@ class View : public AcceleratorTarget { // successful. virtual bool GetAccessibleName(std::wstring* name) { return false; } +#if defined(OS_WIN) + // TODO(port): Make these functions using VARIANT portable. + // Returns the MSAA role of the current view. The role is what assistive // technologies (ATs) use to determine what behavior to expect from a given // control. Sets the input VARIANT appropriately, and returns true if @@ -563,6 +570,7 @@ class View : public AcceleratorTarget { // Returns the MSAA state of the current view. Sets the input VARIANT // appropriately, and returns true if a change was performed successfully. virtual bool GetAccessibleState(VARIANT* state) { return false; } +#endif // defined(OS_WIN) // Assigns a keyboard shortcut string description to the given control. Needed // as a View does not know which shortcut will be associated with it until it @@ -891,10 +899,14 @@ class View : public AcceleratorTarget { // insets is returned. gfx::Insets GetInsets() const; +#if defined(OS_WIN) + // TODO(port): Make GetCursorForPoint portable. + // Return the cursor that should be used for this view or NULL if // the default cursor should be used. The provided point is in the // receiver's coordinate system. virtual HCURSOR GetCursorForPoint(Event::EventType event_type, int x, int y); +#endif // defined(OS_WIN) // Convenience to test whether a point is within this view's bounds virtual bool HitTest(const gfx::Point& l) const; |