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

Side by Side Diff: chrome/browser/extensions/extension_tab_helper.h

Issue 7741037: Add WebstoreInlineInstaller (downloads store data, shows the install UI, and starts the install). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 4 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_EXTENSIONS_EXTENSION_TAB_HELPER_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_TAB_HELPER_H_
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_TAB_HELPER_H_ 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_TAB_HELPER_H_
7 #pragma once 7 #pragma once
8 8
9 #include "content/browser/tab_contents/tab_contents_observer.h" 9 #include "content/browser/tab_contents/tab_contents_observer.h"
10 #include "chrome/browser/extensions/extension_function_dispatcher.h" 10 #include "chrome/browser/extensions/extension_function_dispatcher.h"
11 #include "chrome/browser/extensions/image_loading_tracker.h" 11 #include "chrome/browser/extensions/image_loading_tracker.h"
12 #include "chrome/browser/extensions/webstore_inline_installer.h"
12 #include "chrome/common/web_apps.h" 13 #include "chrome/common/web_apps.h"
13 #include "third_party/skia/include/core/SkBitmap.h" 14 #include "third_party/skia/include/core/SkBitmap.h"
14 15
15 class Extension; 16 class Extension;
16 class TabContentsWrapper; 17 class TabContentsWrapper;
17 struct WebApplicationInfo; 18 struct WebApplicationInfo;
18 19
19 namespace content { 20 namespace content {
20 struct LoadCommittedDetails; 21 struct LoadCommittedDetails;
21 } 22 }
22 23
23 // Per-tab extension helper. Also handles non-extension apps. 24 // Per-tab extension helper. Also handles non-extension apps.
24 class ExtensionTabHelper : public TabContentsObserver, 25 class ExtensionTabHelper : public TabContentsObserver,
25 public ExtensionFunctionDispatcher::Delegate, 26 public ExtensionFunctionDispatcher::Delegate,
26 public ImageLoadingTracker::Observer { 27 public ImageLoadingTracker::Observer,
28 public WebstoreInlineInstaller::Delegate {
27 public: 29 public:
28 explicit ExtensionTabHelper(TabContentsWrapper* wrapper); 30 explicit ExtensionTabHelper(TabContentsWrapper* wrapper);
29 virtual ~ExtensionTabHelper(); 31 virtual ~ExtensionTabHelper();
30 32
31 // Copies the internal state from another ExtensionTabHelper. 33 // Copies the internal state from another ExtensionTabHelper.
32 void CopyStateFrom(const ExtensionTabHelper& source); 34 void CopyStateFrom(const ExtensionTabHelper& source);
33 35
34 // Call this after updating a page action to notify clients about the changes. 36 // Call this after updating a page action to notify clients about the changes.
35 void PageActionStateChanged(); 37 void PageActionStateChanged();
36 38
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 80
79 // Sets a non-extension app icon associated with TabContents and fires an 81 // Sets a non-extension app icon associated with TabContents and fires an
80 // INVALIDATE_TITLE navigation state change to trigger repaint of title. 82 // INVALIDATE_TITLE navigation state change to trigger repaint of title.
81 void SetAppIcon(const SkBitmap& app_icon); 83 void SetAppIcon(const SkBitmap& app_icon);
82 84
83 private: 85 private:
84 // TabContentsObserver overrides. 86 // TabContentsObserver overrides.
85 virtual void DidNavigateMainFramePostCommit( 87 virtual void DidNavigateMainFramePostCommit(
86 const content::LoadCommittedDetails& details, 88 const content::LoadCommittedDetails& details,
87 const ViewHostMsg_FrameNavigate_Params& params) OVERRIDE; 89 const ViewHostMsg_FrameNavigate_Params& params) OVERRIDE;
88 virtual bool OnMessageReceived(const IPC::Message& message); 90 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
89 91
90 // ExtensionFunctionDispatcher::Delegate overrides. 92 // ExtensionFunctionDispatcher::Delegate overrides.
91 virtual Browser* GetBrowser(); 93 virtual Browser* GetBrowser() OVERRIDE;
92 virtual gfx::NativeView GetNativeViewOfHost(); 94 virtual gfx::NativeView GetNativeViewOfHost() OVERRIDE;
93 virtual gfx::NativeWindow GetCustomFrameNativeWindow(); 95 virtual gfx::NativeWindow GetCustomFrameNativeWindow() OVERRIDE;
94 virtual TabContents* GetAssociatedTabContents() const; 96 virtual TabContents* GetAssociatedTabContents() const OVERRIDE;
95 97
96 // Message handlers. 98 // Message handlers.
97 void OnDidGetApplicationInfo(int32 page_id, const WebApplicationInfo& info); 99 void OnDidGetApplicationInfo(int32 page_id, const WebApplicationInfo& info);
98 void OnInstallApplication(const WebApplicationInfo& info); 100 void OnInstallApplication(const WebApplicationInfo& info);
99 void OnInlineWebstoreInstall(const std::string& webstore_item_id); 101 void OnInlineWebstoreInstall(const std::string& webstore_item_id);
100 void OnRequest(const ExtensionHostMsg_Request_Params& params); 102 void OnRequest(const ExtensionHostMsg_Request_Params& params);
101 103
102 // App extensions related methods: 104 // App extensions related methods:
103 105
104 // Resets app_icon_ and if |extension| is non-null creates a new 106 // Resets app_icon_ and if |extension| is non-null creates a new
105 // ImageLoadingTracker to load the extension's image. 107 // ImageLoadingTracker to load the extension's image.
106 void UpdateExtensionAppIcon(const Extension* extension); 108 void UpdateExtensionAppIcon(const Extension* extension);
107 109
108 // ImageLoadingTracker::Observer. 110 // ImageLoadingTracker::Observer.
109 virtual void OnImageLoaded(SkBitmap* image, const ExtensionResource& resource, 111 virtual void OnImageLoaded(SkBitmap* image, const ExtensionResource& resource,
110 int index); 112 int index) OVERRIDE;
113
114 // WebstoreInlineInstaller::Delegate.
115 virtual void OnInlineInstallSuccess() OVERRIDE;
116 virtual void OnInlineInstallFailure(const std::string& error) OVERRIDE;
111 117
112 // Data for app extensions --------------------------------------------------- 118 // Data for app extensions ---------------------------------------------------
113 119
114 // If non-null this tab is an app tab and this is the extension the tab was 120 // If non-null this tab is an app tab and this is the extension the tab was
115 // created for. 121 // created for.
116 const Extension* extension_app_; 122 const Extension* extension_app_;
117 123
118 // Icon for extension_app_ (if non-null) or a manually-set icon for 124 // Icon for extension_app_ (if non-null) or a manually-set icon for
119 // non-extension apps. 125 // non-extension apps.
120 SkBitmap extension_app_icon_; 126 SkBitmap extension_app_icon_;
121 127
122 // Process any extension messages coming from the tab. 128 // Process any extension messages coming from the tab.
123 ExtensionFunctionDispatcher extension_function_dispatcher_; 129 ExtensionFunctionDispatcher extension_function_dispatcher_;
124 130
125 // Used for loading extension_app_icon_. 131 // Used for loading extension_app_icon_.
126 scoped_ptr<ImageLoadingTracker> extension_app_image_loader_; 132 scoped_ptr<ImageLoadingTracker> extension_app_image_loader_;
127 133
128 // Cached web app info data. 134 // Cached web app info data.
129 WebApplicationInfo web_app_info_; 135 WebApplicationInfo web_app_info_;
130 136
131 TabContentsWrapper* wrapper_; 137 TabContentsWrapper* wrapper_;
132 138
133 DISALLOW_COPY_AND_ASSIGN(ExtensionTabHelper); 139 DISALLOW_COPY_AND_ASSIGN(ExtensionTabHelper);
134 }; 140 };
135 141
136 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_TAB_HELPER_H_ 142 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_TAB_HELPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698