| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifndef CHROME_BROWSER_UI_COCOA_INTENTS_WEB_INTENT_PICKER_COCOA2_H_ | 5 #ifndef CHROME_BROWSER_UI_COCOA_INTENTS_WEB_INTENT_PICKER_COCOA2_H_ |
| 6 #define CHROME_BROWSER_UI_COCOA_INTENTS_WEB_INTENT_PICKER_COCOA2_H_ | 6 #define CHROME_BROWSER_UI_COCOA_INTENTS_WEB_INTENT_PICKER_COCOA2_H_ |
| 7 | 7 |
| 8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
| 9 | 9 |
| 10 #include "base/memory/scoped_nsobject.h" | 10 #include "base/memory/scoped_nsobject.h" |
| 11 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_mac2.h" | 11 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_mac2.h" |
| 12 #include "chrome/browser/ui/intents/web_intent_picker.h" | 12 #include "chrome/browser/ui/intents/web_intent_picker.h" |
| 13 #include "chrome/browser/ui/intents/web_intent_picker_model_observer.h" | 13 #include "chrome/browser/ui/intents/web_intent_picker_model_observer.h" |
| 14 | 14 |
| 15 @class WebIntentPickerViewController; | 15 @class WebIntentPickerViewController; |
| 16 | 16 |
| 17 // An implementation of WebIntentPicker for Cocoa. Bridges between the C++ and | 17 // An implementation of WebIntentPicker for Cocoa. Bridges between the C++ and |
| 18 // the Cocoa WebIntentPickerViewController object. Note, this will eventually | 18 // the Cocoa WebIntentPickerViewController object. Note, this will eventually |
| 19 // replace WebIntentPickerCocoa, see http://crbug.com/152010. | 19 // replace WebIntentPickerCocoa, see http://crbug.com/152010. |
| 20 class WebIntentPickerCocoa2 : public WebIntentPicker, | 20 class WebIntentPickerCocoa2 : public WebIntentPicker, |
| 21 public WebIntentPickerModelObserver, | 21 public WebIntentPickerModelObserver, |
| 22 public ConstrainedWindowMacDelegate2 { | 22 public ConstrainedWindowMacDelegate2 { |
| 23 public: | 23 public: |
| 24 WebIntentPickerCocoa2(content::WebContents* web_contents, | 24 WebIntentPickerCocoa2(content::WebContents* web_contents, |
| 25 WebIntentPickerDelegate* delegate, | 25 WebIntentPickerDelegate* delegate, |
| 26 WebIntentPickerModel* model); | 26 WebIntentPickerModel* model); |
| 27 virtual ~WebIntentPickerCocoa2(); | 27 virtual ~WebIntentPickerCocoa2(); |
| 28 | 28 |
| 29 WebIntentPickerDelegate* delegate() const { return delegate_; } | 29 WebIntentPickerDelegate* delegate() const { |
| 30 DCHECK(delegate_); |
| 31 return delegate_; |
| 32 } |
| 33 |
| 30 WebIntentPickerModel* model() const { return model_; } | 34 WebIntentPickerModel* model() const { return model_; } |
| 31 content::WebContents* web_contents() const { return web_contents_; } | 35 content::WebContents* web_contents() const { return web_contents_; } |
| 32 ConstrainedWindowMac2* constrained_window() const { | 36 ConstrainedWindowMac2* constrained_window() const { |
| 33 return constrained_window_.get(); | 37 return constrained_window_.get(); |
| 34 } | 38 } |
| 35 WebIntentPickerViewController* view_controller() const { | 39 WebIntentPickerViewController* view_controller() const { |
| 36 return view_controller_; | 40 return view_controller_; |
| 37 } | 41 } |
| 38 | 42 |
| 39 // WebIntentPicker implementation. | 43 // WebIntentPicker implementation. |
| 40 virtual void Close() OVERRIDE; | 44 virtual void Close() OVERRIDE; |
| 41 virtual void SetActionString(const string16& action) OVERRIDE; | 45 virtual void SetActionString(const string16& action) OVERRIDE; |
| 42 virtual void OnExtensionInstallSuccess(const std::string& id) OVERRIDE; | 46 virtual void OnExtensionInstallSuccess(const std::string& id) OVERRIDE; |
| 43 virtual void OnExtensionInstallFailure(const std::string& id) OVERRIDE; | 47 virtual void OnExtensionInstallFailure(const std::string& id) OVERRIDE; |
| 44 virtual void OnShowExtensionInstallDialog( | 48 virtual void OnShowExtensionInstallDialog( |
| 45 gfx::NativeWindow parent, | 49 gfx::NativeWindow parent, |
| 46 content::PageNavigator* navigator, | 50 content::PageNavigator* navigator, |
| 47 ExtensionInstallPrompt::Delegate* delegate, | 51 ExtensionInstallPrompt::Delegate* delegate, |
| 48 const ExtensionInstallPrompt::Prompt& prompt) OVERRIDE; | 52 const ExtensionInstallPrompt::Prompt& prompt) OVERRIDE; |
| 49 virtual void OnInlineDispositionAutoResize(const gfx::Size& size) OVERRIDE; | 53 virtual void OnInlineDispositionAutoResize(const gfx::Size& size) OVERRIDE; |
| 50 virtual void OnInlineDispositionHandleKeyboardEvent( | 54 virtual void OnInlineDispositionHandleKeyboardEvent( |
| 51 const content::NativeWebKeyboardEvent& event) OVERRIDE; | 55 const content::NativeWebKeyboardEvent& event) OVERRIDE; |
| 52 virtual void OnPendingAsyncCompleted() OVERRIDE; | 56 virtual void OnPendingAsyncCompleted() OVERRIDE; |
| 57 virtual void InvalidateDelegate() OVERRIDE; |
| 53 virtual void OnInlineDispositionWebContentsLoaded( | 58 virtual void OnInlineDispositionWebContentsLoaded( |
| 54 content::WebContents* web_contents) OVERRIDE; | 59 content::WebContents* web_contents) OVERRIDE; |
| 55 virtual gfx::Size GetMinInlineDispositionSize() OVERRIDE; | 60 virtual gfx::Size GetMinInlineDispositionSize() OVERRIDE; |
| 56 | 61 |
| 57 // WebIntentPickerModelObserver implementation. | 62 // WebIntentPickerModelObserver implementation. |
| 58 virtual void OnModelChanged(WebIntentPickerModel* model) OVERRIDE; | 63 virtual void OnModelChanged(WebIntentPickerModel* model) OVERRIDE; |
| 59 virtual void OnFaviconChanged(WebIntentPickerModel* model, | 64 virtual void OnFaviconChanged(WebIntentPickerModel* model, |
| 60 size_t index) OVERRIDE; | 65 size_t index) OVERRIDE; |
| 61 virtual void OnExtensionIconChanged(WebIntentPickerModel* model, | 66 virtual void OnExtensionIconChanged(WebIntentPickerModel* model, |
| 62 const std::string& extension_id) OVERRIDE; | 67 const std::string& extension_id) OVERRIDE; |
| 63 virtual void OnInlineDisposition(const string16& title, | 68 virtual void OnInlineDisposition(const string16& title, |
| 64 const GURL& url) OVERRIDE; | 69 const GURL& url) OVERRIDE; |
| 65 | 70 |
| 66 // ConstrainedWindowMacDelegate2 implementation. | 71 // ConstrainedWindowMacDelegate2 implementation. |
| 67 virtual void OnConstrainedWindowClosed( | 72 virtual void OnConstrainedWindowClosed( |
| 68 ConstrainedWindowMac2* window) OVERRIDE; | 73 ConstrainedWindowMac2* window) OVERRIDE; |
| 69 | 74 |
| 70 private: | 75 private: |
| 71 content::WebContents* const web_contents_; | 76 content::WebContents* const web_contents_; |
| 72 WebIntentPickerDelegate* const delegate_; | 77 WebIntentPickerDelegate* delegate_; |
| 73 WebIntentPickerModel* model_; | 78 WebIntentPickerModel* model_; |
| 74 scoped_nsobject<WebIntentPickerViewController> view_controller_; | 79 scoped_nsobject<WebIntentPickerViewController> view_controller_; |
| 75 scoped_ptr<ConstrainedWindowMac2> constrained_window_; | 80 scoped_ptr<ConstrainedWindowMac2> constrained_window_; |
| 76 }; | 81 }; |
| 77 | 82 |
| 78 #endif // CHROME_BROWSER_UI_COCOA_INTENTS_WEB_INTENT_PICKER_COCOA2_H_ | 83 #endif // CHROME_BROWSER_UI_COCOA_INTENTS_WEB_INTENT_PICKER_COCOA2_H_ |
| OLD | NEW |