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

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

Issue 2772713002: Remove IDC_CREATE_SHORTCUT and its associated UI. (Closed)
Patch Set: rebase to get r462081 Created 3 years, 8 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
« no previous file with comments | « chrome/browser/extensions/tab_helper.h ('k') | chrome/browser/shell_integration_linux.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 registrar_.Add(this, 191 registrar_.Add(this,
192 content::NOTIFICATION_LOAD_STOP, 192 content::NOTIFICATION_LOAD_STOP,
193 content::Source<NavigationController>( 193 content::Source<NavigationController>(
194 &web_contents->GetController())); 194 &web_contents->GetController()));
195 } 195 }
196 196
197 TabHelper::~TabHelper() { 197 TabHelper::~TabHelper() {
198 RemoveScriptExecutionObserver(ActivityLog::GetInstance(profile_)); 198 RemoveScriptExecutionObserver(ActivityLog::GetInstance(profile_));
199 } 199 }
200 200
201 void TabHelper::CreateApplicationShortcuts() {
202 DCHECK(CanCreateApplicationShortcuts());
203 if (pending_web_app_action_ != NONE)
204 return;
205
206 // Start fetching web app info for CreateApplicationShortcut dialog and show
207 // the dialog when the data is available in OnDidGetApplicationInfo.
208 GetApplicationInfo(CREATE_SHORTCUT);
209 }
210
211 void TabHelper::CreateHostedAppFromWebContents() { 201 void TabHelper::CreateHostedAppFromWebContents() {
212 DCHECK(CanCreateBookmarkApp()); 202 DCHECK(CanCreateBookmarkApp());
213 if (pending_web_app_action_ != NONE) 203 if (pending_web_app_action_ != NONE)
214 return; 204 return;
215 205
216 // Start fetching web app info for CreateApplicationShortcut dialog and show 206 // Start fetching web app info for CreateApplicationShortcut dialog and show
217 // the dialog when the data is available in OnDidGetApplicationInfo. 207 // the dialog when the data is available in OnDidGetApplicationInfo.
218 GetApplicationInfo(CREATE_HOSTED_APP); 208 GetApplicationInfo(CREATE_HOSTED_APP);
219 } 209 }
220 210
221 bool TabHelper::CanCreateApplicationShortcuts() const {
222 #if defined(OS_MACOSX)
223 return false;
224 #else
225 return web_app::IsValidUrl(web_contents()->GetURL());
226 #endif
227 }
228
229 bool TabHelper::CanCreateBookmarkApp() const { 211 bool TabHelper::CanCreateBookmarkApp() const {
230 return !profile_->IsGuestSession() && 212 return !profile_->IsGuestSession() &&
231 !profile_->IsSystemProfile() && 213 !profile_->IsSystemProfile() &&
232 IsValidBookmarkAppUrl(web_contents()->GetURL()); 214 IsValidBookmarkAppUrl(web_contents()->GetURL());
233 } 215 }
234 216
235 void TabHelper::AddScriptExecutionObserver(ScriptExecutionObserver* observer) { 217 void TabHelper::AddScriptExecutionObserver(ScriptExecutionObserver* observer) {
236 script_execution_observers_.AddObserver(observer); 218 script_execution_observers_.AddObserver(observer);
237 } 219 }
238 220
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 void TabHelper::OnDidGetWebApplicationInfo(const WebApplicationInfo& info) { 373 void TabHelper::OnDidGetWebApplicationInfo(const WebApplicationInfo& info) {
392 web_app_info_ = info; 374 web_app_info_ = info;
393 375
394 NavigationEntry* entry = 376 NavigationEntry* entry =
395 web_contents()->GetController().GetLastCommittedEntry(); 377 web_contents()->GetController().GetLastCommittedEntry();
396 if (!entry || last_committed_nav_entry_unique_id_ != entry->GetUniqueID()) 378 if (!entry || last_committed_nav_entry_unique_id_ != entry->GetUniqueID())
397 return; 379 return;
398 last_committed_nav_entry_unique_id_ = 0; 380 last_committed_nav_entry_unique_id_ = 0;
399 381
400 switch (pending_web_app_action_) { 382 switch (pending_web_app_action_) {
401 #if !defined(OS_MACOSX)
402 case CREATE_SHORTCUT: {
403 chrome::ShowCreateWebAppShortcutsDialog(
404 web_contents()->GetTopLevelNativeWindow(),
405 web_contents());
406 break;
407 }
408 #endif
409 case CREATE_HOSTED_APP: { 383 case CREATE_HOSTED_APP: {
410 if (web_app_info_.app_url.is_empty()) 384 if (web_app_info_.app_url.is_empty())
411 web_app_info_.app_url = web_contents()->GetURL(); 385 web_app_info_.app_url = web_contents()->GetURL();
412 386
413 if (web_app_info_.title.empty()) 387 if (web_app_info_.title.empty())
414 web_app_info_.title = web_contents()->GetTitle(); 388 web_app_info_.title = web_contents()->GetTitle();
415 if (web_app_info_.title.empty()) 389 if (web_app_info_.title.empty())
416 web_app_info_.title = base::UTF8ToUTF16(web_app_info_.app_url.spec()); 390 web_app_info_.title = base::UTF8ToUTF16(web_app_info_.app_url.spec());
417 391
418 bookmark_app_helper_.reset( 392 bookmark_app_helper_.reset(
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
682 } 656 }
683 } 657 }
684 658
685 void TabHelper::SetTabId(content::RenderFrameHost* render_frame_host) { 659 void TabHelper::SetTabId(content::RenderFrameHost* render_frame_host) {
686 render_frame_host->Send( 660 render_frame_host->Send(
687 new ExtensionMsg_SetTabId(render_frame_host->GetRoutingID(), 661 new ExtensionMsg_SetTabId(render_frame_host->GetRoutingID(),
688 SessionTabHelper::IdForTab(web_contents()))); 662 SessionTabHelper::IdForTab(web_contents())));
689 } 663 }
690 664
691 } // namespace extensions 665 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/tab_helper.h ('k') | chrome/browser/shell_integration_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698