14 New, 1 Updated patches
[webos-internals:shivaramv-modifications.git] / browser / browser-shake-to-reload.patch
1 diff --git a/usr/palm/applications/com.palm.app.browser/app/controllers/page-assistant.js b/usr/palm/applications/com.palm.app.browser/app/controllers/page-assistant.js
2 index 09c898f..ddfa6f0 100644
3 --- a/usr/palm/applications/com.palm.app.browser/app/controllers/page-assistant.js
4 +++ b/usr/palm/applications/com.palm.app.browser/app/controllers/page-assistant.js
5 @@ -74,6 +74,7 @@ function PageAssistant(params){
6         this._onUrlRedirectHandler = this._onUrlRedirect.bind(this);
7         this._onWebViewResourceHandoffHandler = this._onWebViewResourceHandoff.bind(this);
8         this._onWebViewSingleTap = this._onWebViewSingleTap.bind(this);
9 +       this._shakeHandler = this._handleShake.bindAsEventListener(this);
10  
11         // Spotlight handlers (flash support)
12         this._onSpotlightStartHandler = this._onSpotlightStart.bind(this);
13 @@ -308,6 +309,7 @@ PageAssistant.prototype.activate = function(message) {
14  
15                 this.controller.document.addEventListener(Mojo.Event.activate, this._onCardActivateHandler, false);
16                 this.controller.document.addEventListener(Mojo.Event.deactivate, this._onCardDeactivateHandler, false);
17 +               this.controller.document.addEventListener('shakeend', this._shakeHandler, false);
18  
19                 var webView = this.controller.get('web_view');
20                 webView.addEventListener(Mojo.Event.webViewLinkClicked, this._onLinkClickedHandler, true);
21 @@ -412,6 +414,7 @@ PageAssistant.prototype.deactivate = function() {
22                 // Cleanup focus handlers.
23                 this.controller.document.removeEventListener(Mojo.Event.activate, this._onCardActivateHandler, false);
24                 this.controller.document.removeEventListener(Mojo.Event.deactivate, this._onCardDeactivateHandler, false);
25 +               this.controller.document.removeEventListener('shakeend', this._shakeHandler, false);
26  
27                 var webView = this.controller.get('web_view');
28                 webView.removeEventListener(Mojo.Event.webViewTitleUrlChanged, this._onTitleUrlChangeHandler, true);
29 @@ -729,6 +732,11 @@ PageAssistant.prototype._onWebViewSingleTap = function(event) {
30         }
31  };
32  
33 +PageAssistant.prototype._handleShake = function(event) {
34 +
35 +       this._reload();
36 +};
37 +
38  PageAssistant.prototype._onCardActivate = function(event) {
39  
40         this.hasFocus = true;