OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/ui/autofill/autofill_dialog_sign_in_delegate.h" | 5 #include "chrome/browser/ui/autofill/autofill_dialog_sign_in_delegate.h" |
6 | 6 |
7 #include "chrome/browser/ui/autofill/autofill_dialog_view.h" | 7 #include "chrome/browser/ui/autofill/autofill_dialog_view.h" |
8 #include "chrome/browser/ui/browser_finder.h" | 8 #include "chrome/browser/ui/browser_finder.h" |
9 #include "chrome/browser/ui/browser_tabstrip.h" | 9 #include "chrome/browser/ui/browser_tabstrip.h" |
10 #include "components/autofill/content/browser/wallet/wallet_service_url.h" | 10 #include "components/autofill/content/browser/wallet/wallet_service_url.h" |
11 #include "content/public/browser/render_view_host.h" | 11 #include "content/public/browser/render_view_host.h" |
12 #include "content/public/browser/web_contents.h" | 12 #include "content/public/browser/web_contents.h" |
13 #include "content/public/common/renderer_preferences.h" | 13 #include "content/public/common/renderer_preferences.h" |
| 14 #include "third_party/WebKit/public/web/WebInputEvent.h" |
14 #include "ui/base/window_open_disposition.h" | 15 #include "ui/base/window_open_disposition.h" |
15 | 16 |
16 namespace autofill { | 17 namespace autofill { |
17 | 18 |
18 namespace { | 19 namespace { |
19 | 20 |
20 using content::OpenURLParams; | 21 using content::OpenURLParams; |
21 | 22 |
22 // Signals if |params| require opening inside the current WebContents. | 23 // Signals if |params| require opening inside the current WebContents. |
23 bool IsInPageTransition(const OpenURLParams& params) { | 24 bool IsInPageTransition(const OpenURLParams& params) { |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 WindowOpenDisposition disposition, | 91 WindowOpenDisposition disposition, |
91 const gfx::Rect& initial_pos, | 92 const gfx::Rect& initial_pos, |
92 bool user_gesture, | 93 bool user_gesture, |
93 bool* was_blocked) { | 94 bool* was_blocked) { |
94 chrome::AddWebContents( | 95 chrome::AddWebContents( |
95 chrome::FindBrowserWithWebContents(originating_web_contents_), | 96 chrome::FindBrowserWithWebContents(originating_web_contents_), |
96 source, new_contents, disposition, initial_pos, user_gesture, | 97 source, new_contents, disposition, initial_pos, user_gesture, |
97 was_blocked); | 98 was_blocked); |
98 } | 99 } |
99 | 100 |
| 101 bool AutofillDialogSignInDelegate::PreHandleGestureEvent( |
| 102 content::WebContents* source, |
| 103 const blink::WebGestureEvent& event) { |
| 104 // Disable pinch zooming. |
| 105 return event.type == blink::WebGestureEvent::GesturePinchBegin || |
| 106 event.type == blink::WebGestureEvent::GesturePinchUpdate || |
| 107 event.type == blink::WebGestureEvent::GesturePinchEnd; |
| 108 } |
| 109 |
100 void AutofillDialogSignInDelegate::RenderViewCreated( | 110 void AutofillDialogSignInDelegate::RenderViewCreated( |
101 content::RenderViewHost* render_view_host) { | 111 content::RenderViewHost* render_view_host) { |
102 EnableAutoResize(); | 112 EnableAutoResize(); |
103 | 113 |
104 // Set the initial size as soon as we have an RVH to avoid bad size jumping. | 114 // Set the initial size as soon as we have an RVH to avoid bad size jumping. |
105 dialog_view_->OnSignInResize(minimum_size_); | 115 dialog_view_->OnSignInResize(minimum_size_); |
106 } | 116 } |
107 | 117 |
108 void AutofillDialogSignInDelegate::UpdateLimitsAndEnableAutoResize( | 118 void AutofillDialogSignInDelegate::UpdateLimitsAndEnableAutoResize( |
109 const gfx::Size& minimum_size, | 119 const gfx::Size& minimum_size, |
110 const gfx::Size& maximum_size) { | 120 const gfx::Size& maximum_size) { |
111 minimum_size_ = minimum_size; | 121 minimum_size_ = minimum_size; |
112 maximum_size_ = maximum_size; | 122 maximum_size_ = maximum_size; |
113 EnableAutoResize(); | 123 EnableAutoResize(); |
114 } | 124 } |
115 | 125 |
116 void AutofillDialogSignInDelegate::EnableAutoResize() { | 126 void AutofillDialogSignInDelegate::EnableAutoResize() { |
117 DCHECK(!minimum_size_.IsEmpty()); | 127 DCHECK(!minimum_size_.IsEmpty()); |
118 DCHECK(!maximum_size_.IsEmpty()); | 128 DCHECK(!maximum_size_.IsEmpty()); |
119 content::RenderViewHost* host = web_contents()->GetRenderViewHost(); | 129 content::RenderViewHost* host = web_contents()->GetRenderViewHost(); |
120 if (host) | 130 if (host) |
121 host->EnableAutoResize(minimum_size_, maximum_size_); | 131 host->EnableAutoResize(minimum_size_, maximum_size_); |
122 } | 132 } |
123 | 133 |
124 } // namespace autofill | 134 } // namespace autofill |
OLD | NEW |