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

Unified Diff: athena/extensions/chrome/athena_chrome_app_delegate.cc

Issue 563083003: V2 app support step3: Athena's NativeAppWindow (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
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 side-by-side diff with in-line comments
Download patch
Index: athena/extensions/chrome/athena_chrome_app_delegate.cc
diff --git a/athena/extensions/chrome/athena_app_delegate.cc b/athena/extensions/chrome/athena_chrome_app_delegate.cc
similarity index 40%
rename from athena/extensions/chrome/athena_app_delegate.cc
rename to athena/extensions/chrome/athena_chrome_app_delegate.cc
index 1046cc756584b9315017305c4e8e470f96933384..ce9865ed6fd9302f0b1270b4c22dcc4a64752bfe 100644
--- a/athena/extensions/chrome/athena_app_delegate.cc
+++ b/athena/extensions/chrome/athena_chrome_app_delegate.cc
@@ -2,36 +2,18 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "athena/extensions/chrome/athena_app_delegate.h"
+#include "athena/extensions/chrome/athena_chrome_app_delegate.h"
-#include "athena/activity/public/activity_factory.h"
-#include "athena/activity/public/activity_manager.h"
-#include "athena/env/public/athena_env.h"
-#include "base/memory/scoped_ptr.h"
-#include "base/strings/stringprintf.h"
-#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/extensions/chrome_extension_web_contents_observer.h"
#include "chrome/browser/favicon/favicon_tab_helper.h"
#include "chrome/browser/file_select_helper.h"
#include "chrome/browser/media/media_capture_devices_dispatcher.h"
#include "chrome/browser/platform_util.h"
-#include "chrome/browser/profiles/profile.h"
-#include "chrome/browser/shell_integration.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_dialogs.h"
-#include "chrome/browser/ui/browser_tabstrip.h"
-#include "chrome/browser/ui/browser_window.h"
-#include "chrome/browser/ui/scoped_tabbed_browser_displayer.h"
-#include "chrome/browser/ui/web_contents_sizer.h"
#include "chrome/common/extensions/chrome_extension_messages.h"
-#include "content/public/browser/browser_context.h"
-#include "content/public/browser/notification_service.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/web_contents.h"
-#include "content/public/browser/web_contents_delegate.h"
-#include "extensions/common/constants.h"
-#include "extensions/grit/extensions_browser_resources.h"
-#include "ui/base/resource/resource_bundle.h"
#if defined(ENABLE_PRINTING)
#if defined(ENABLE_FULL_PRINTING)
@@ -43,53 +25,15 @@
#endif // defined(ENABLE_PRINTING)
namespace athena {
-namespace {
-content::WebContents* OpenURLInActivity(
- content::BrowserContext* context,
- const content::OpenURLParams& params) {
- // Force all links to open in a new activity.
- Activity* activity = ActivityFactory::Get()->CreateWebActivity(
- context, base::string16(), params.url);
- ActivityManager::Get()->AddActivity(activity);
- // TODO(oshima): Get the web cotnents from activity.
- return NULL;
+AthenaChromeAppDelegate::AthenaChromeAppDelegate() {
}
-} // namespace
-
-// This is a extra step to open a new Activity when a link is simply clicked
-// on an app activity (which usually replaces the content).
-class AthenaAppDelegate::NewWindowContentsDelegate
- : public content::WebContentsDelegate {
- public:
- NewWindowContentsDelegate() {}
- virtual ~NewWindowContentsDelegate() {}
-
- // content::WebContentsDelegate:
- virtual content::WebContents* OpenURLFromTab(
- content::WebContents* source,
- const content::OpenURLParams& params) OVERRIDE {
- if (!source)
- return NULL;
-
- return OpenURLInActivity(source->GetBrowserContext(), params);
- }
-
- private:
- DISALLOW_COPY_AND_ASSIGN(NewWindowContentsDelegate);
-};
-
-AthenaAppDelegate::AthenaAppDelegate()
- : new_window_contents_delegate_(new NewWindowContentsDelegate()) {
+AthenaChromeAppDelegate::~AthenaChromeAppDelegate() {
}
-AthenaAppDelegate::~AthenaAppDelegate() {
- if (!terminating_callback_.is_null())
- AthenaEnv::Get()->RemoveTerminatingCallback(terminating_callback_);
-}
-
-void AthenaAppDelegate::InitWebContents(content::WebContents* web_contents) {
+void AthenaChromeAppDelegate::InitWebContents(
+ content::WebContents* web_contents) {
FaviconTabHelper::CreateForWebContents(web_contents);
#if defined(ENABLE_PRINTING)
@@ -104,40 +48,19 @@ void AthenaAppDelegate::InitWebContents(content::WebContents* web_contents) {
web_contents);
}
-void AthenaAppDelegate::ResizeWebContents(content::WebContents* web_contents,
- const gfx::Size& size) {
- ::ResizeWebContents(web_contents, size);
-}
-
-content::WebContents* AthenaAppDelegate::OpenURLFromTab(
- content::BrowserContext* context,
- content::WebContents* source,
- const content::OpenURLParams& params) {
- return OpenURLInActivity(context, params);
-}
-
-void AthenaAppDelegate::AddNewContents(content::BrowserContext* context,
- content::WebContents* new_contents,
- WindowOpenDisposition disposition,
- const gfx::Rect& initial_pos,
- bool user_gesture,
- bool* was_blocked) {
- new_contents->SetDelegate(new_window_contents_delegate_.get());
-}
-
-content::ColorChooser* AthenaAppDelegate::ShowColorChooser(
+content::ColorChooser* AthenaChromeAppDelegate::ShowColorChooser(
content::WebContents* web_contents,
SkColor initial_color) {
return chrome::ShowColorChooser(web_contents, initial_color);
}
-void AthenaAppDelegate::RunFileChooser(
+void AthenaChromeAppDelegate::RunFileChooser(
content::WebContents* tab,
const content::FileChooserParams& params) {
FileSelectHelper::RunFileChooser(tab, params);
}
-void AthenaAppDelegate::RequestMediaAccessPermission(
+void AthenaChromeAppDelegate::RequestMediaAccessPermission(
content::WebContents* web_contents,
const content::MediaStreamRequest& request,
const content::MediaResponseCallback& callback,
@@ -146,7 +69,7 @@ void AthenaAppDelegate::RequestMediaAccessPermission(
web_contents, request, callback, extension);
}
-bool AthenaAppDelegate::CheckMediaAccessPermission(
+bool AthenaChromeAppDelegate::CheckMediaAccessPermission(
content::WebContents* web_contents,
const GURL& security_origin,
content::MediaStreamType type,
@@ -156,17 +79,7 @@ bool AthenaAppDelegate::CheckMediaAccessPermission(
web_contents, security_origin, type, extension);
}
-int AthenaAppDelegate::PreferredIconSize() {
- // TODO(oshima): Find out what to use.
- return extension_misc::EXTENSION_ICON_SMALL;
-}
-
-gfx::ImageSkia AthenaAppDelegate::GetAppDefaultIcon() {
- return *ResourceBundle::GetSharedInstance().GetImageSkiaNamed(
- IDR_APP_DEFAULT_ICON);
-}
-
-void AthenaAppDelegate::SetWebContentsBlocked(
+void AthenaChromeAppDelegate::SetWebContentsBlocked(
content::WebContents* web_contents,
bool blocked) {
// RenderViewHost may be NULL during shutdown.
@@ -177,17 +90,4 @@ void AthenaAppDelegate::SetWebContentsBlocked(
}
}
-bool AthenaAppDelegate::IsWebContentsVisible(
- content::WebContents* web_contents) {
- return platform_util::IsVisible(web_contents->GetNativeView());
-}
-
-void AthenaAppDelegate::SetTerminatingCallback(const base::Closure& callback) {
- if (!terminating_callback_.is_null())
- AthenaEnv::Get()->RemoveTerminatingCallback(terminating_callback_);
- terminating_callback_ = callback;
- if (!terminating_callback_.is_null())
- AthenaEnv::Get()->AddTerminatingCallback(terminating_callback_);
-}
-
} // namespace athena
« no previous file with comments | « athena/extensions/chrome/athena_chrome_app_delegate.h ('k') | athena/extensions/chrome/athena_chrome_apps_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698