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

Side by Side Diff: chrome/browser/extensions/tab_helper.cc

Issue 667053007: Use manifest for streamlined hosted app creation for title and URL. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git/+/master
Patch Set: Fix memory leak in manifest_manager_host Created 6 years, 2 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
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 #include "chrome/browser/extensions/tab_helper.h" 5 #include "chrome/browser/extensions/tab_helper.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "chrome/browser/chrome_notification_types.h" 10 #include "chrome/browser/chrome_notification_types.h"
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 content::Source<NavigationController>( 112 content::Source<NavigationController>(
113 &web_contents->GetController())); 113 &web_contents->GetController()));
114 } 114 }
115 115
116 TabHelper::~TabHelper() { 116 TabHelper::~TabHelper() {
117 RemoveScriptExecutionObserver(ActivityLog::GetInstance(profile_)); 117 RemoveScriptExecutionObserver(ActivityLog::GetInstance(profile_));
118 } 118 }
119 119
120 void TabHelper::CreateApplicationShortcuts() { 120 void TabHelper::CreateApplicationShortcuts() {
121 DCHECK(CanCreateApplicationShortcuts()); 121 DCHECK(CanCreateApplicationShortcuts());
122 if (pending_web_app_action_ != NONE)
123 return;
124
122 // Start fetching web app info for CreateApplicationShortcut dialog and show 125 // Start fetching web app info for CreateApplicationShortcut dialog and show
123 // the dialog when the data is available in OnDidGetApplicationInfo. 126 // the dialog when the data is available in OnDidGetApplicationInfo.
124 GetApplicationInfo(CREATE_SHORTCUT); 127 GetApplicationInfo(CREATE_SHORTCUT);
125 } 128 }
126 129
127 void TabHelper::CreateHostedAppFromWebContents() { 130 void TabHelper::CreateHostedAppFromWebContents() {
128 DCHECK(CanCreateBookmarkApp()); 131 DCHECK(CanCreateBookmarkApp());
132 if (pending_web_app_action_ != NONE)
133 return;
134
129 // Start fetching web app info for CreateApplicationShortcut dialog and show 135 // Start fetching web app info for CreateApplicationShortcut dialog and show
130 // the dialog when the data is available in OnDidGetApplicationInfo. 136 // the dialog when the data is available in OnDidGetApplicationInfo.
131 GetApplicationInfo(CREATE_HOSTED_APP); 137 GetApplicationInfo(CREATE_HOSTED_APP);
132 } 138 }
133 139
134 bool TabHelper::CanCreateApplicationShortcuts() const { 140 bool TabHelper::CanCreateApplicationShortcuts() const {
135 #if defined(OS_MACOSX) 141 #if defined(OS_MACOSX)
136 return false; 142 return false;
137 #else 143 #else
138 return web_app::IsValidUrl(web_contents()->GetURL()) && 144 return web_app::IsValidUrl(web_contents()->GetURL());
139 pending_web_app_action_ == NONE;
140 #endif 145 #endif
141 } 146 }
142 147
143 bool TabHelper::CanCreateBookmarkApp() const { 148 bool TabHelper::CanCreateBookmarkApp() const {
144 #if defined(OS_MACOSX) 149 #if defined(OS_MACOSX)
145 return false; 150 return false;
146 #else 151 #else
147 return IsValidBookmarkAppUrl(web_contents()->GetURL()) && 152 return IsValidBookmarkAppUrl(web_contents()->GetURL());
148 pending_web_app_action_ == NONE;
149 #endif 153 #endif
150 } 154 }
151 155
152 void TabHelper::AddScriptExecutionObserver(ScriptExecutionObserver* observer) { 156 void TabHelper::AddScriptExecutionObserver(ScriptExecutionObserver* observer) {
153 script_execution_observers_.AddObserver(observer); 157 script_execution_observers_.AddObserver(observer);
154 } 158 }
155 159
156 void TabHelper::RemoveScriptExecutionObserver( 160 void TabHelper::RemoveScriptExecutionObserver(
157 ScriptExecutionObserver* observer) { 161 ScriptExecutionObserver* observer) {
158 script_execution_observers_.RemoveObserver(observer); 162 script_execution_observers_.RemoveObserver(observer);
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after
535 } 539 }
536 } 540 }
537 541
538 void TabHelper::SetTabId(RenderViewHost* render_view_host) { 542 void TabHelper::SetTabId(RenderViewHost* render_view_host) {
539 render_view_host->Send( 543 render_view_host->Send(
540 new ExtensionMsg_SetTabId(render_view_host->GetRoutingID(), 544 new ExtensionMsg_SetTabId(render_view_host->GetRoutingID(),
541 SessionTabHelper::IdForTab(web_contents()))); 545 SessionTabHelper::IdForTab(web_contents())));
542 } 546 }
543 547
544 } // namespace extensions 548 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/bookmark_app_helper_unittest.cc ('k') | content/browser/manifest/manifest_manager_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698