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

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

Issue 568823003: Merge Android RetrieveWebappInformation and Extensions GetApplicationInfo. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@manifest_manager_content
Patch Set: Created 6 years, 3 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 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 enabled_extensions.GetExtensionOrAppByURL(params.url)); 243 enabled_extensions.GetExtensionOrAppByURL(params.url));
244 } 244 }
245 245
246 if (!details.is_in_page) 246 if (!details.is_in_page)
247 ExtensionActionAPI::Get(context)->ClearAllValuesForTab(web_contents()); 247 ExtensionActionAPI::Get(context)->ClearAllValuesForTab(web_contents());
248 } 248 }
249 249
250 bool TabHelper::OnMessageReceived(const IPC::Message& message) { 250 bool TabHelper::OnMessageReceived(const IPC::Message& message) {
251 bool handled = true; 251 bool handled = true;
252 IPC_BEGIN_MESSAGE_MAP(TabHelper, message) 252 IPC_BEGIN_MESSAGE_MAP(TabHelper, message)
253 IPC_MESSAGE_HANDLER(ChromeExtensionHostMsg_DidGetApplicationInfo, 253 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_DidGetWebApplicationInfo,
254 OnDidGetApplicationInfo) 254 OnDidGetWebApplicationInfo)
255 IPC_MESSAGE_HANDLER(ExtensionHostMsg_InlineWebstoreInstall, 255 IPC_MESSAGE_HANDLER(ExtensionHostMsg_InlineWebstoreInstall,
256 OnInlineWebstoreInstall) 256 OnInlineWebstoreInstall)
257 IPC_MESSAGE_HANDLER(ExtensionHostMsg_GetAppInstallState, 257 IPC_MESSAGE_HANDLER(ExtensionHostMsg_GetAppInstallState,
258 OnGetAppInstallState); 258 OnGetAppInstallState);
259 IPC_MESSAGE_HANDLER(ExtensionHostMsg_Request, OnRequest) 259 IPC_MESSAGE_HANDLER(ExtensionHostMsg_Request, OnRequest)
260 IPC_MESSAGE_HANDLER(ExtensionHostMsg_ContentScriptsExecuting, 260 IPC_MESSAGE_HANDLER(ExtensionHostMsg_ContentScriptsExecuting,
261 OnContentScriptsExecuting) 261 OnContentScriptsExecuting)
262 IPC_MESSAGE_HANDLER(ExtensionHostMsg_OnWatchedPageChange, 262 IPC_MESSAGE_HANDLER(ExtensionHostMsg_OnWatchedPageChange,
263 OnWatchedPageChange) 263 OnWatchedPageChange)
264 IPC_MESSAGE_UNHANDLED(handled = false) 264 IPC_MESSAGE_UNHANDLED(handled = false)
(...skipping 16 matching lines...) Expand all
281 WebContents* new_web_contents) { 281 WebContents* new_web_contents) {
282 // When the WebContents that this is attached to is cloned, give the new clone 282 // When the WebContents that this is attached to is cloned, give the new clone
283 // a TabHelper and copy state over. 283 // a TabHelper and copy state over.
284 CreateForWebContents(new_web_contents); 284 CreateForWebContents(new_web_contents);
285 TabHelper* new_helper = FromWebContents(new_web_contents); 285 TabHelper* new_helper = FromWebContents(new_web_contents);
286 286
287 new_helper->SetExtensionApp(extension_app()); 287 new_helper->SetExtensionApp(extension_app());
288 new_helper->extension_app_icon_ = extension_app_icon_; 288 new_helper->extension_app_icon_ = extension_app_icon_;
289 } 289 }
290 290
291 void TabHelper::OnDidGetApplicationInfo(const WebApplicationInfo& info) { 291 void TabHelper::OnDidGetWebApplicationInfo(const WebApplicationInfo& info) {
292 #if !defined(OS_MACOSX) 292 #if !defined(OS_MACOSX)
293 web_app_info_ = info; 293 web_app_info_ = info;
294 294
295 NavigationEntry* entry = 295 NavigationEntry* entry =
296 web_contents()->GetController().GetLastCommittedEntry(); 296 web_contents()->GetController().GetLastCommittedEntry();
297 if (!entry || last_committed_page_id_ != entry->GetPageID()) 297 if (!entry || last_committed_page_id_ != entry->GetPageID())
298 return; 298 return;
299 last_committed_page_id_ = -1; 299 last_committed_page_id_ = -1;
300 300
301 switch (pending_web_app_action_) { 301 switch (pending_web_app_action_) {
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
506 506
507 void TabHelper::GetApplicationInfo(WebAppAction action) { 507 void TabHelper::GetApplicationInfo(WebAppAction action) {
508 NavigationEntry* entry = 508 NavigationEntry* entry =
509 web_contents()->GetController().GetLastCommittedEntry(); 509 web_contents()->GetController().GetLastCommittedEntry();
510 if (!entry) 510 if (!entry)
511 return; 511 return;
512 512
513 pending_web_app_action_ = action; 513 pending_web_app_action_ = action;
514 last_committed_page_id_ = entry->GetPageID(); 514 last_committed_page_id_ = entry->GetPageID();
515 515
516 Send(new ChromeExtensionMsg_GetApplicationInfo(routing_id())); 516 Send(new ChromeViewMsg_GetWebApplicationInfo(routing_id()));
517 } 517 }
518 518
519 void TabHelper::Observe(int type, 519 void TabHelper::Observe(int type,
520 const content::NotificationSource& source, 520 const content::NotificationSource& source,
521 const content::NotificationDetails& details) { 521 const content::NotificationDetails& details) {
522 DCHECK_EQ(content::NOTIFICATION_LOAD_STOP, type); 522 DCHECK_EQ(content::NOTIFICATION_LOAD_STOP, type);
523 const NavigationController& controller = 523 const NavigationController& controller =
524 *content::Source<NavigationController>(source).ptr(); 524 *content::Source<NavigationController>(source).ptr();
525 DCHECK_EQ(controller.GetWebContents(), web_contents()); 525 DCHECK_EQ(controller.GetWebContents(), web_contents());
526 526
527 if (update_shortcut_on_load_complete_) { 527 if (update_shortcut_on_load_complete_) {
528 update_shortcut_on_load_complete_ = false; 528 update_shortcut_on_load_complete_ = false;
529 // Schedule a shortcut update when web application info is available if 529 // Schedule a shortcut update when web application info is available if
530 // last committed entry is not NULL. Last committed entry could be NULL 530 // last committed entry is not NULL. Last committed entry could be NULL
531 // when an interstitial page is injected (e.g. bad https certificate, 531 // when an interstitial page is injected (e.g. bad https certificate,
532 // malware site etc). When this happens, we abort the shortcut update. 532 // malware site etc). When this happens, we abort the shortcut update.
533 if (controller.GetLastCommittedEntry()) 533 if (controller.GetLastCommittedEntry())
534 GetApplicationInfo(UPDATE_SHORTCUT); 534 GetApplicationInfo(UPDATE_SHORTCUT);
535 } 535 }
536 } 536 }
537 537
538 void TabHelper::SetTabId(RenderViewHost* render_view_host) { 538 void TabHelper::SetTabId(RenderViewHost* render_view_host) {
539 render_view_host->Send( 539 render_view_host->Send(
540 new ExtensionMsg_SetTabId(render_view_host->GetRoutingID(), 540 new ExtensionMsg_SetTabId(render_view_host->GetRoutingID(),
541 SessionTabHelper::IdForTab(web_contents()))); 541 SessionTabHelper::IdForTab(web_contents())));
542 } 542 }
543 543
544 } // namespace extensions 544 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/tab_helper.h ('k') | chrome/browser/web_applications/web_app_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698