Skip to content

Commit 57780e5

Browse files
committed
Merge windows with Linux
Conflicts: nw.gypi
2 parents 022ac60 + c3ca61b commit 57780e5

21 files changed

Lines changed: 366 additions & 115 deletions

nw.gypi

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,8 @@
108108
'<(DEPTH)/chrome/browser/ui/views/status_icons/status_icon_win.h',
109109
'<(DEPTH)/chrome/browser/ui/views/status_icons/status_tray_linux.cc',
110110
'<(DEPTH)/chrome/browser/ui/views/status_icons/status_tray_linux.h',
111+
'<(DEPTH)/chrome/browser/ui/views/status_icons/status_tray_state_changer_win.cc',
112+
'<(DEPTH)/chrome/browser/ui/views/status_icons/status_tray_state_changer_win.h',
111113
'<(DEPTH)/chrome/browser/ui/views/status_icons/status_tray_win.cc',
112114
'<(DEPTH)/chrome/browser/ui/views/status_icons/status_tray_win.h',
113115
'<(DEPTH)/chrome/common/chrome_constants.cc',
@@ -241,7 +243,6 @@
241243
'src/browser/shell_download_manager_delegate.cc',
242244
'src/browser/shell_download_manager_delegate.h',
243245
'src/browser/shell_download_manager_delegate_win.cc',
244-
'src/browser/shell_download_manager_delegate_gtk.cc',
245246
'src/browser/shell_download_manager_delegate_mac.mm',
246247
'src/browser/shell_javascript_dialog_creator.cc',
247248
'src/browser/shell_javascript_dialog_creator.h',
@@ -270,8 +271,6 @@
270271
'src/breakpad_linux_impl.h',
271272
'src/breakpad_mac.mm',
272273
'src/breakpad_mac.h',
273-
'src/breakpad_win.cc',
274-
'src/breakpad_win.h',
275274
'src/hard_error_handler_win.cc',
276275
'src/hard_error_handler_win.h',
277276
'src/geolocation/shell_access_token_store.cc',
@@ -307,7 +306,6 @@
307306
'src/renderer/printing/print_web_view_helper.h',
308307
'src/renderer/printing/print_web_view_helper_linux.cc',
309308
'src/renderer/printing/print_web_view_helper_mac.mm',
310-
'src/renderer/printing/print_web_view_helper_win.cc',
311309
'src/renderer/nw_render_view_observer.cc',
312310
'src/renderer/nw_render_view_observer.h',
313311
'src/renderer/shell_content_renderer_client.cc',
@@ -386,6 +384,15 @@
386384
'<(DEPTH)/build/win/ftol3.obj',
387385
],
388386
}],
387+
['win_pdf_metafile_for_printing==1', {
388+
'sources': [
389+
'src/renderer/printing/print_web_view_helper_pdf_win.cc',
390+
],
391+
}, {
392+
'sources': [
393+
'src/renderer/printing/print_web_view_helper_win.cc',
394+
],
395+
}],
389396
['OS=="win"', {
390397
'sources': [
391398
'<(DEPTH)/chrome/browser/ui/views/constrained_window_views.cc',
@@ -445,8 +452,7 @@
445452
'dependencies': [
446453
'<(DEPTH)/ui/views/controls/webview/webview.gyp:webview',
447454
'<(DEPTH)/ui/views/views.gyp:views',
448-
'<(DEPTH)/webkit/webkit_resources.gyp:webkit_resources',
449-
'<(DEPTH)/webkit/webkit_resources.gyp:webkit_strings',
455+
#'<(DEPTH)/webkit/webkit_resources.gyp:webkit_strings',
450456
],
451457
'configurations': {
452458
'Debug_Base': {
@@ -457,7 +463,7 @@
457463
},
458464
},
459465
},
460-
'msvs_disabled_warnings': [ 4800 ],
466+
'msvs_disabled_warnings': [ 4800, 4819 ],
461467
}], # OS=="win"
462468
],
463469
},
@@ -614,9 +620,9 @@
614620
'<(SHARED_INTERMEDIATE_DIR)/content/content_resources.pak',
615621
'<(SHARED_INTERMEDIATE_DIR)/content/nw_resources.pak',
616622
'<(SHARED_INTERMEDIATE_DIR)/net/net_resources.pak',
617-
'<(SHARED_INTERMEDIATE_DIR)/ui/app_locale_settings/app_locale_settings_en-US.pak',
618623
'<(SHARED_INTERMEDIATE_DIR)/ui/resources/ui_resources_100_percent.pak',
619624
'<(SHARED_INTERMEDIATE_DIR)/ui/resources/webui_resources.pak',
625+
'<(SHARED_INTERMEDIATE_DIR)/ui/strings/app_locale_settings_en-US.pak',
620626
'<(SHARED_INTERMEDIATE_DIR)/ui/strings/ui_strings_en-US.pak',
621627
'<(SHARED_INTERMEDIATE_DIR)/webkit/devtools_resources.pak',
622628
'<(SHARED_INTERMEDIATE_DIR)/blink/public/resources/blink_resources.pak',
@@ -825,9 +831,12 @@
825831
],
826832
}],
827833
['OS=="win"', {
834+
'dependencies': [
835+
'<(DEPTH)/ui/resources/ui_resources.gyp:ui_resources',
836+
],
828837
'sources': [
829838
'src/shell.rc',
830-
'<(SHARED_INTERMEDIATE_DIR)/ui/ui_resources/ui_unscaled_resources.rc',
839+
'<(SHARED_INTERMEDIATE_DIR)/ui/resources/ui_unscaled_resources.rc',
831840
],
832841
'configurations': {
833842
'Debug_Base': {

src/api/dispatcher_bindings.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -461,8 +461,8 @@ void DispatcherBindings::CrashRenderer(
461461
void DispatcherBindings::SetCrashDumpDir(
462462
const v8::FunctionCallbackInfo<v8::Value>& args) {
463463
#if defined(OS_WIN) || defined(OS_MACOSX)
464-
std::string path = *v8::String::Utf8Value(args[0]);
465-
SetCrashDumpPath(path.c_str());
464+
//std::string path = *v8::String::Utf8Value(args[0]);
465+
//FIXME: SetCrashDumpPath(path.c_str());
466466
#endif
467467
}
468468

src/api/menu/menu.h

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@
2828
#include <string>
2929
#include <vector>
3030

31+
#if defined(OS_WIN)
32+
#include "ui/views/controls/menu/native_menu_win.h"
33+
#endif
34+
3135
#if defined(OS_MACOSX)
3236
#if __OBJC__
3337
@class NSMenu;
@@ -41,7 +45,6 @@ class NativeWindowCocoa;
4145

4246
#elif defined(OS_WIN) || defined(OS_LINUX)
4347
#include "content/nw/src/api/menu/menu_delegate.h"
44-
//#include "ui/views/controls/menu/native_menu_win.h"
4548
#include "chrome/browser/status_icons/status_icon_menu_model.h"
4649
#include "ui/views/focus/focus_manager.h"
4750
namespace nw {
@@ -130,17 +133,17 @@ class Menu : public Base {
130133
void UpdateStates();
131134

132135
#elif defined(OS_WIN)
133-
friend class nw::NativeWindowWin;
136+
friend class nw::NativeWindowAura;
134137

135138
void Rebuild(const HMENU *parent_menu = NULL);
136139
void UpdateStates();
137-
void SetWindow(nw::NativeWindowWin* win);
140+
void SetWindow(nw::NativeWindowAura* win);
138141

139142
//**Never Try to free this pointer**
140143
//We get it from top widget
141144
views::FocusManager *focus_manager_;
142145
std::vector<MenuItem*> menu_items_;
143-
nw::NativeWindowWin* window_;
146+
nw::NativeWindowAura* window_;
144147
// Flag to indicate the menu has been modified since last show, so we should
145148
// rebuild the menu before next show.
146149
bool is_menu_modified_;

src/api/menu/menu_views.cc

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,17 @@
3131
#include "ui/aura/client/screen_position_client.h"
3232
#include "ui/aura/window.h"
3333
#include "ui/aura/window_tree_host.h"
34-
//#include "ui/gfx/gdi_util.h"
35-
//#include "ui/gfx/icon_util.h"
36-
//#include "ui/views/controls/menu/menu_2.h"
3734
#include "ui/views/controls/menu/menu_runner.h"
3835
#include "ui/views/widget/widget.h"
3936
#include "ui/views/focus/focus_manager.h"
4037
#include "vector"
4138

39+
#if defined(OS_WIN)
40+
#include "ui/gfx/gdi_util.h"
41+
#include "ui/gfx/icon_util.h"
42+
#include "ui/views/controls/menu/menu_2.h"
43+
#endif
44+
4245
namespace {
4346

4447
#if defined(OS_WIN)

src/browser/autofill_popup_base_view.cc

Lines changed: 16 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,9 @@
88
#include "base/location.h"
99
#include "base/message_loop/message_loop.h"
1010
#include "chrome/browser/ui/autofill/popup_constants.h"
11-
#include "ui/gfx/point.h"
12-
#include "ui/gfx/screen.h"
1311
#include "ui/views/border.h"
14-
#include "ui/views/event_utils.h"
1512
#include "ui/views/widget/widget.h"
16-
17-
#if defined(USE_AURA)
1813
#include "ui/wm/core/window_animations.h"
19-
#endif
2014

2115
namespace autofill {
2216

@@ -49,7 +43,8 @@ AutofillPopupBaseView::~AutofillPopupBaseView() {
4943
}
5044

5145
void AutofillPopupBaseView::DoShow() {
52-
if (!GetWidget()) {
46+
const bool initialize_widget = !GetWidget();
47+
if (initialize_widget) {
5348
observing_widget_->AddObserver(this);
5449

5550
views::FocusManager* focus_manager = observing_widget_->GetFocusManager();
@@ -71,11 +66,10 @@ void AutofillPopupBaseView::DoShow() {
7166
params.parent = container_view();
7267
widget->Init(params);
7368
widget->SetContentsView(this);
74-
#if defined(USE_AURA)
69+
7570
// No animation for popup appearance (too distracting).
7671
wm::SetWindowVisibilityAnimationTransition(
7772
widget->GetNativeView(), wm::ANIMATE_HIDE);
78-
#endif
7973
}
8074

8175
SetBorder(views::Border::CreateSolidBorder(kPopupBorderThickness,
@@ -84,8 +78,10 @@ void AutofillPopupBaseView::DoShow() {
8478
DoUpdateBoundsAndRedrawPopup();
8579
GetWidget()->Show();
8680

87-
if (ShouldHideOnOutsideClick())
88-
GetWidget()->SetCapture(this);
81+
// Showing the widget can change native focus (which would result in an
82+
// immediate hiding of the popup). Only start observing after shown.
83+
if (initialize_widget)
84+
views::WidgetFocusManager::GetInstance()->AddFocusChangeListener(this);
8985
}
9086

9187
void AutofillPopupBaseView::DoHide() {
@@ -108,13 +104,21 @@ void AutofillPopupBaseView::DoHide() {
108104
void AutofillPopupBaseView::RemoveObserver() {
109105
observing_widget_->GetFocusManager()->UnregisterAccelerators(this);
110106
observing_widget_->RemoveObserver(this);
107+
views::WidgetFocusManager::GetInstance()->RemoveFocusChangeListener(this);
111108
}
112109

113110
void AutofillPopupBaseView::DoUpdateBoundsAndRedrawPopup() {
114111
GetWidget()->SetBounds(delegate_->popup_bounds());
115112
SchedulePaint();
116113
}
117114

115+
void AutofillPopupBaseView::OnNativeFocusChange(
116+
gfx::NativeView focused_before,
117+
gfx::NativeView focused_now) {
118+
if (GetWidget() && GetWidget()->GetNativeView() != focused_now)
119+
HideController();
120+
}
121+
118122
void AutofillPopupBaseView::OnWidgetBoundsChanged(views::Widget* widget,
119123
const gfx::Rect& new_bounds) {
120124
DCHECK_EQ(widget, observing_widget_);
@@ -157,39 +161,10 @@ void AutofillPopupBaseView::OnMouseMoved(const ui::MouseEvent& event) {
157161
}
158162

159163
bool AutofillPopupBaseView::OnMousePressed(const ui::MouseEvent& event) {
160-
if (HitTestPoint(event.location()))
161-
return true;
162-
163-
if (ShouldHideOnOutsideClick()) {
164-
GetWidget()->ReleaseCapture();
165-
166-
gfx::Point screen_loc = event.location();
167-
views::View::ConvertPointToScreen(this, &screen_loc);
168-
169-
ui::MouseEvent mouse_event = event;
170-
mouse_event.set_location(screen_loc);
171-
172-
if (ShouldRepostEvent(mouse_event)) {
173-
gfx::NativeView native_view = GetWidget()->GetNativeView();
174-
gfx::Screen* screen = gfx::Screen::GetScreenFor(native_view);
175-
gfx::NativeWindow window = screen->GetWindowAtScreenPoint(screen_loc);
176-
views::RepostLocatedEvent(window, mouse_event);
177-
}
178-
179-
HideController();
180-
// |this| is now deleted.
181-
}
182-
183-
return false;
164+
return event.GetClickCount() == 1;
184165
}
185166

186167
void AutofillPopupBaseView::OnMouseReleased(const ui::MouseEvent& event) {
187-
// Because this view can can be shown in response to a mouse press, it can
188-
// receive an OnMouseReleased event just after showing. This breaks the mouse
189-
// capture, so restart capturing here.
190-
if (ShouldHideOnOutsideClick() && GetWidget())
191-
GetWidget()->SetCapture(this);
192-
193168
// We only care about the left click.
194169
if (event.IsOnlyLeftMouseButton() && HitTestPoint(event.location()))
195170
AcceptSelection(event.location());
@@ -256,27 +231,13 @@ void AutofillPopupBaseView::ClearSelection() {
256231
delegate_->SelectionCleared();
257232
}
258233

259-
bool AutofillPopupBaseView::ShouldHideOnOutsideClick() {
260-
if (delegate_)
261-
return delegate_->ShouldHideOnOutsideClick();
262-
263-
// |this| instance should be in the process of being destroyed, so the return
264-
// value shouldn't matter.
265-
return false;
266-
}
267-
268234
void AutofillPopupBaseView::HideController() {
269235
if (delegate_)
270236
delegate_->Hide();
271237
}
272238

273-
bool AutofillPopupBaseView::ShouldRepostEvent(const ui::MouseEvent& event) {
274-
return delegate_->ShouldRepostEvent(event);
275-
}
276-
277239
gfx::NativeView AutofillPopupBaseView::container_view() {
278240
return delegate_->container_view();
279241
}
280242

281-
282243
} // namespace autofill

src/browser/autofill_popup_base_view.h

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
#define CHROME_BROWSER_UI_VIEWS_AUTOFILL_AUTOFILL_POPUP_BASE_VIEW_H_
77

88
#include "base/memory/weak_ptr.h"
9-
#include "content/nw/src/browser/autofill_popup_view_delegate.h"
9+
#include "chrome/browser/ui/autofill/autofill_popup_view_delegate.h"
10+
#include "ui/views/focus/widget_focus_manager.h"
1011
#include "ui/views/widget/widget_delegate.h"
1112
#include "ui/views/widget/widget_observer.h"
1213

@@ -23,7 +24,16 @@ namespace autofill {
2324
// Class that deals with the event handling for Autofill-style popups. This
2425
// class should only be instantiated by sub-classes.
2526
class AutofillPopupBaseView : public views::WidgetDelegateView,
27+
public views::WidgetFocusChangeListener,
2628
public views::WidgetObserver {
29+
public:
30+
static const SkColor kBorderColor;
31+
static const SkColor kHoveredBackgroundColor;
32+
static const SkColor kItemTextColor;
33+
static const SkColor kPopupBackground;
34+
static const SkColor kValueTextColor;
35+
static const SkColor kWarningTextColor;
36+
2737
protected:
2838
explicit AutofillPopupBaseView(AutofillPopupViewDelegate* delegate,
2939
views::Widget* observing_widget);
@@ -38,13 +48,6 @@ class AutofillPopupBaseView : public views::WidgetDelegateView,
3848
// Update size of popup and paint.
3949
void DoUpdateBoundsAndRedrawPopup();
4050

41-
static const SkColor kBorderColor;
42-
static const SkColor kHoveredBackgroundColor;
43-
static const SkColor kItemTextColor;
44-
static const SkColor kPopupBackground;
45-
static const SkColor kValueTextColor;
46-
static const SkColor kWarningTextColor;
47-
4851
private:
4952
friend class AutofillPopupBaseViewTest;
5053

@@ -58,6 +61,10 @@ class AutofillPopupBaseView : public views::WidgetDelegateView,
5861
virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE;
5962
virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) OVERRIDE;
6063

64+
// views::WidgetFocusChangeListener implementation.
65+
virtual void OnNativeFocusChange(gfx::NativeView focused_before,
66+
gfx::NativeView focused_now) OVERRIDE;
67+
6168
// views::WidgetObserver implementation.
6269
virtual void OnWidgetBoundsChanged(views::Widget* widget,
6370
const gfx::Rect& new_bounds) OVERRIDE;
@@ -69,16 +76,10 @@ class AutofillPopupBaseView : public views::WidgetDelegateView,
6976
void AcceptSelection(const gfx::Point& point);
7077
void ClearSelection();
7178

72-
// If the popup should be hidden if the user clicks outside it's bounds.
73-
bool ShouldHideOnOutsideClick();
74-
7579
// Hide the controller of this view. This assumes that doing so will
7680
// eventually hide this view in the process.
7781
void HideController();
7882

79-
// Returns true if this event should be passed along.
80-
bool ShouldRepostEvent(const ui::MouseEvent& event);
81-
8283
// Must return the container view for this popup.
8384
gfx::NativeView container_view();
8485

0 commit comments

Comments
 (0)