Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(238)

Side by Side Diff: chrome/browser/ui/cocoa/web_intent_picker_cocoa.h

Issue 9148032: [Web Intents] Refactor picker to use WebIntentPickerModel. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: groby's fix Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_WEB_INTENT_PICKER_COCOA_H_ 5 #ifndef CHROME_BROWSER_UI_COCOA_WEB_INTENT_PICKER_COCOA_H_
6 #define CHROME_BROWSER_UI_COCOA_WEB_INTENT_PICKER_COCOA_H_ 6 #define CHROME_BROWSER_UI_COCOA_WEB_INTENT_PICKER_COCOA_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.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.h"
14 #include "chrome/browser/ui/intents/web_intent_picker_model_observer.h"
13 15
14 class InlineHtmlContentDelegate; 16 class InlineHtmlContentDelegate;
15 class TabContentsWrapper; 17 class TabContentsWrapper;
16 @class WebIntentBubbleController; 18 @class WebIntentBubbleController;
17 19
18 // A bridge class that enables communication between ObjectiveC and C++. 20 // A bridge class that enables communication between ObjectiveC and C++.
19 class WebIntentPickerCocoa : public WebIntentPicker { 21 class WebIntentPickerCocoa : public WebIntentPicker,
22 public WebIntentPickerModelObserver {
20 public: 23 public:
21 // |browser| and |delegate| cannot be NULL. 24 // |browser| and |delegate| cannot be NULL.
22 // |wrapper| is unused. 25 // |wrapper| is unused.
23 WebIntentPickerCocoa(Browser* browser, 26 WebIntentPickerCocoa(Browser* browser,
24 TabContentsWrapper* wrapper, 27 TabContentsWrapper* wrapper,
25 WebIntentPickerDelegate* delegate); 28 WebIntentPickerDelegate* delegate,
29 WebIntentPickerModel* model);
26 virtual ~WebIntentPickerCocoa(); 30 virtual ~WebIntentPickerCocoa();
27 31
28 // WebIntentPickerDelegate forwarding API. 32 // WebIntentPickerDelegate forwarding API.
29 void OnCancelled(); 33 void OnCancelled();
30 void OnServiceChosen(size_t index); 34 void OnServiceChosen(size_t index);
31 35
32 void set_controller(WebIntentBubbleController* controller); 36 void set_controller(WebIntentBubbleController* controller);
33 37
34 // WebIntentPicker: 38 // WebIntentPicker:
35 virtual void SetServiceURLs(const std::vector<GURL>& urls) OVERRIDE;
36 virtual void SetServiceIcon(size_t index, const SkBitmap& icon) OVERRIDE;
37 virtual void SetDefaultServiceIcon(size_t index) OVERRIDE;
38 virtual void Close() OVERRIDE; 39 virtual void Close() OVERRIDE;
39 virtual content::WebContents* SetInlineDisposition(const GURL& url) OVERRIDE; 40
41 // WebIntentPickerModelObserver implementation.
42 virtual void OnModelChanged(WebIntentPickerModel* model) OVERRIDE;
43 virtual void OnFaviconChanged(WebIntentPickerModel* model,
44 size_t index) OVERRIDE;
45 virtual void OnInlineDisposition(WebIntentPickerModel* model) OVERRIDE;
40 46
41 private: 47 private:
42 // Weak pointer to the |delegate_| to notify about user choice/cancellation. 48 // Weak pointer to the |delegate_| to notify about user choice/cancellation.
43 WebIntentPickerDelegate* delegate_; 49 WebIntentPickerDelegate* delegate_;
44 50
51 // The picker model. Weak reference.
52 WebIntentPickerModel* model_;
53
45 Browser* browser_; // The browser we're in. Weak Reference. 54 Browser* browser_; // The browser we're in. Weak Reference.
46 55
47 WebIntentBubbleController* controller_; // Weak reference. 56 WebIntentBubbleController* controller_; // Weak reference.
48 57
49 // Tab contents wrapper to hold intent page if inline disposition is used. 58 // Tab contents wrapper to hold intent page if inline disposition is used.
50 scoped_ptr<TabContentsWrapper> inline_disposition_tab_contents_; 59 scoped_ptr<TabContentsWrapper> inline_disposition_tab_contents_;
51 60
52 // Delegate for inline disposition tab contents. 61 // Delegate for inline disposition tab contents.
53 scoped_ptr<InlineHtmlContentDelegate> inline_disposition_delegate_; 62 scoped_ptr<InlineHtmlContentDelegate> inline_disposition_delegate_;
54 63
55 // Default constructor, for testing only. 64 // Default constructor, for testing only.
56 WebIntentPickerCocoa(); 65 WebIntentPickerCocoa();
57 66
58 // For testing access. 67 // For testing access.
59 friend class WebIntentBubbleControllerTest; 68 friend class WebIntentBubbleControllerTest;
60 69
61 DISALLOW_COPY_AND_ASSIGN(WebIntentPickerCocoa); 70 DISALLOW_COPY_AND_ASSIGN(WebIntentPickerCocoa);
62 }; 71 };
63 72
64 #endif // CHROME_BROWSER_UI_COCOA_WEB_INTENT_PICKER_COCOA_H_ 73 #endif // CHROME_BROWSER_UI_COCOA_WEB_INTENT_PICKER_COCOA_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/web_intent_bubble_controller_unittest.mm ('k') | chrome/browser/ui/cocoa/web_intent_picker_cocoa.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698