Index: athena/extensions/athena_app_delegate_base.cc |
diff --git a/athena/extensions/athena_app_delegate_base.cc b/athena/extensions/athena_app_delegate_base.cc |
deleted file mode 100644 |
index 298028b8c51f0936e1a76cb5942f5074dc9ab951..0000000000000000000000000000000000000000 |
--- a/athena/extensions/athena_app_delegate_base.cc |
+++ /dev/null |
@@ -1,110 +0,0 @@ |
-// Copyright 2014 The Chromium Authors. All rights reserved. |
-// Use of this source code is governed by a BSD-style license that can be |
-// found in the LICENSE file. |
- |
-#include "athena/extensions/athena_app_delegate_base.h" |
- |
-#include "athena/activity/public/activity.h" |
-#include "athena/activity/public/activity_factory.h" |
-#include "athena/env/public/athena_env.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/aura/window.h" |
-#include "ui/base/resource/resource_bundle.h" |
-#include "ui/gfx/geometry/rect.h" |
- |
-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); |
- Activity::Show(activity); |
- // TODO(oshima): Get the web cotnents from activity. |
- return nullptr; |
-} |
- |
-} // 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 AthenaAppDelegateBase::NewActivityContentsDelegate |
- : public content::WebContentsDelegate { |
- public: |
- NewActivityContentsDelegate() {} |
- ~NewActivityContentsDelegate() override {} |
- |
- // content::WebContentsDelegate: |
- content::WebContents* OpenURLFromTab( |
- content::WebContents* source, |
- const content::OpenURLParams& params) override { |
- if (!source) |
- return nullptr; |
- return OpenURLInActivity(source->GetBrowserContext(), params); |
- } |
- |
- private: |
- DISALLOW_COPY_AND_ASSIGN(NewActivityContentsDelegate); |
-}; |
- |
-AthenaAppDelegateBase::AthenaAppDelegateBase() |
- : new_window_contents_delegate_(new NewActivityContentsDelegate) { |
-} |
- |
-AthenaAppDelegateBase::~AthenaAppDelegateBase() { |
- if (!terminating_callback_.is_null()) |
- AthenaEnv::Get()->RemoveTerminatingCallback(terminating_callback_); |
-} |
- |
-void AthenaAppDelegateBase::RenderViewCreated( |
- content::RenderViewHost* render_view_host) { |
- // No implementation necessary for athena. |
-} |
- |
-void AthenaAppDelegateBase::ResizeWebContents( |
- content::WebContents* web_contents, |
- const gfx::Size& size) { |
- aura::Window* window = web_contents->GetNativeView(); |
- window->SetBounds(gfx::Rect(window->bounds().origin(), size)); |
-} |
- |
-content::WebContents* AthenaAppDelegateBase::OpenURLFromTab( |
- content::BrowserContext* context, |
- content::WebContents* source, |
- const content::OpenURLParams& params) { |
- return OpenURLInActivity(context, params); |
-} |
- |
-void AthenaAppDelegateBase::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()); |
-} |
- |
-int AthenaAppDelegateBase::PreferredIconSize() { |
- // TODO(oshima): Find out what to use. |
- return extension_misc::EXTENSION_ICON_SMALL; |
-} |
- |
-bool AthenaAppDelegateBase::IsWebContentsVisible( |
- content::WebContents* web_contents) { |
- return web_contents->GetNativeView()->IsVisible(); |
-} |
- |
-void AthenaAppDelegateBase::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 |