Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.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 16 matching lines...) Expand all Loading... | |
| 27 #include "chrome/browser/extensions/webstore_inline_installer_factory.h" | 27 #include "chrome/browser/extensions/webstore_inline_installer_factory.h" |
| 28 #include "chrome/browser/profiles/profile.h" | 28 #include "chrome/browser/profiles/profile.h" |
| 29 #include "chrome/browser/sessions/session_id.h" | 29 #include "chrome/browser/sessions/session_id.h" |
| 30 #include "chrome/browser/sessions/session_tab_helper.h" | 30 #include "chrome/browser/sessions/session_tab_helper.h" |
| 31 #include "chrome/browser/shell_integration.h" | 31 #include "chrome/browser/shell_integration.h" |
| 32 #include "chrome/browser/ui/browser_commands.h" | 32 #include "chrome/browser/ui/browser_commands.h" |
| 33 #include "chrome/browser/ui/browser_dialogs.h" | 33 #include "chrome/browser/ui/browser_dialogs.h" |
| 34 #include "chrome/browser/ui/browser_finder.h" | 34 #include "chrome/browser/ui/browser_finder.h" |
| 35 #include "chrome/browser/ui/browser_window.h" | 35 #include "chrome/browser/ui/browser_window.h" |
| 36 #include "chrome/browser/ui/host_desktop.h" | 36 #include "chrome/browser/ui/host_desktop.h" |
| 37 #include "chrome/browser/ui/web_applications/web_app_ui.h" | |
| 38 #include "chrome/browser/web_applications/web_app.h" | 37 #include "chrome/browser/web_applications/web_app.h" |
| 39 #include "chrome/common/chrome_switches.h" | 38 #include "chrome/common/chrome_switches.h" |
| 40 #include "chrome/common/extensions/chrome_extension_messages.h" | 39 #include "chrome/common/extensions/chrome_extension_messages.h" |
| 41 #include "chrome/common/extensions/extension_constants.h" | 40 #include "chrome/common/extensions/extension_constants.h" |
| 42 #include "chrome/common/extensions/extension_icon_set.h" | 41 #include "chrome/common/extensions/extension_icon_set.h" |
| 43 #include "chrome/common/extensions/manifest_handlers/app_launch_info.h" | 42 #include "chrome/common/extensions/manifest_handlers/app_launch_info.h" |
| 44 #include "chrome/common/extensions/manifest_handlers/icons_handler.h" | 43 #include "chrome/common/extensions/manifest_handlers/icons_handler.h" |
| 45 #include "chrome/common/render_messages.h" | 44 #include "chrome/common/render_messages.h" |
| 46 #include "chrome/common/url_constants.h" | 45 #include "chrome/common/url_constants.h" |
| 47 #include "content/public/browser/invalidate_type.h" | 46 #include "content/public/browser/invalidate_type.h" |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 63 #include "extensions/common/extension.h" | 62 #include "extensions/common/extension.h" |
| 64 #include "extensions/common/extension_messages.h" | 63 #include "extensions/common/extension_messages.h" |
| 65 #include "extensions/common/extension_resource.h" | 64 #include "extensions/common/extension_resource.h" |
| 66 #include "extensions/common/extension_urls.h" | 65 #include "extensions/common/extension_urls.h" |
| 67 #include "extensions/common/feature_switch.h" | 66 #include "extensions/common/feature_switch.h" |
| 68 | 67 |
| 69 #if defined(OS_CHROMEOS) | 68 #if defined(OS_CHROMEOS) |
| 70 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" | 69 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" |
| 71 #endif | 70 #endif |
| 72 | 71 |
| 72 #if defined(OS_WIN) | |
| 73 #include "chrome/browser/web_applications/web_app_win.h" | |
| 74 #endif | |
| 75 | |
| 73 using content::NavigationController; | 76 using content::NavigationController; |
| 74 using content::NavigationEntry; | 77 using content::NavigationEntry; |
| 75 using content::RenderViewHost; | 78 using content::RenderViewHost; |
| 76 using content::WebContents; | 79 using content::WebContents; |
| 77 | 80 |
| 78 DEFINE_WEB_CONTENTS_USER_DATA_KEY(extensions::TabHelper); | 81 DEFINE_WEB_CONTENTS_USER_DATA_KEY(extensions::TabHelper); |
| 79 | 82 |
| 80 namespace extensions { | 83 namespace extensions { |
| 81 | 84 |
| 82 TabHelper::ScriptExecutionObserver::ScriptExecutionObserver( | 85 TabHelper::ScriptExecutionObserver::ScriptExecutionObserver( |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 342 if (web_app_info_.title.empty()) | 345 if (web_app_info_.title.empty()) |
| 343 web_app_info_.title = base::UTF8ToUTF16(web_app_info_.app_url.spec()); | 346 web_app_info_.title = base::UTF8ToUTF16(web_app_info_.app_url.spec()); |
| 344 | 347 |
| 345 bookmark_app_helper_.reset(new BookmarkAppHelper( | 348 bookmark_app_helper_.reset(new BookmarkAppHelper( |
| 346 profile_->GetExtensionService(), web_app_info_, web_contents())); | 349 profile_->GetExtensionService(), web_app_info_, web_contents())); |
| 347 bookmark_app_helper_->Create(base::Bind( | 350 bookmark_app_helper_->Create(base::Bind( |
| 348 &TabHelper::FinishCreateBookmarkApp, base::Unretained(this))); | 351 &TabHelper::FinishCreateBookmarkApp, base::Unretained(this))); |
| 349 break; | 352 break; |
| 350 } | 353 } |
| 351 case UPDATE_SHORTCUT: { | 354 case UPDATE_SHORTCUT: { |
| 355 #if defined(OS_WIN) | |
|
benwells
2014/03/28 02:55:26
I'd prefer to keep the #if in web app code.
That
jackhou1
2014/04/02 03:25:56
Done.
| |
| 352 web_app::UpdateShortcutForTabContents(web_contents()); | 356 web_app::UpdateShortcutForTabContents(web_contents()); |
| 357 #endif | |
| 353 break; | 358 break; |
| 354 } | 359 } |
| 355 default: | 360 default: |
| 356 NOTREACHED(); | 361 NOTREACHED(); |
| 357 break; | 362 break; |
| 358 } | 363 } |
| 359 | 364 |
| 360 // The hosted app action will be cleared once the installation completes or | 365 // The hosted app action will be cleared once the installation completes or |
| 361 // fails. | 366 // fails. |
| 362 if (pending_web_app_action_ != CREATE_HOSTED_APP) | 367 if (pending_web_app_action_ != CREATE_HOSTED_APP) |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 565 } | 570 } |
| 566 } | 571 } |
| 567 | 572 |
| 568 void TabHelper::SetTabId(RenderViewHost* render_view_host) { | 573 void TabHelper::SetTabId(RenderViewHost* render_view_host) { |
| 569 render_view_host->Send( | 574 render_view_host->Send( |
| 570 new ExtensionMsg_SetTabId(render_view_host->GetRoutingID(), | 575 new ExtensionMsg_SetTabId(render_view_host->GetRoutingID(), |
| 571 SessionID::IdForTab(web_contents()))); | 576 SessionID::IdForTab(web_contents()))); |
| 572 } | 577 } |
| 573 | 578 |
| 574 } // namespace extensions | 579 } // namespace extensions |
| OLD | NEW |