diff options
29 files changed, 533 insertions, 218 deletions
diff --git a/athena/athena.gyp b/athena/athena.gyp index 8453bcb..e3bddc3 100644 --- a/athena/athena.gyp +++ b/athena/athena.gyp @@ -65,6 +65,7 @@ 'home/minimized_home.h', 'home/public/app_model_builder.h', 'home/public/home_card.h', + 'home/public/search_controller_factory.h', 'input/accelerator_manager_impl.cc', 'input/accelerator_manager_impl.h', 'input/input_manager_impl.cc', @@ -158,7 +159,6 @@ 'content/public/app_registry.h', 'content/public/content_activity_factory_creator.h', 'content/public/dialogs.h', - 'content/public/scheme_classifier_factory.h', 'content/public/web_contents_view_delegate_creator.h', 'content/render_view_context_menu_impl.cc', 'content/render_view_context_menu_impl.h', @@ -174,6 +174,7 @@ 'extensions/athena_native_app_window_views.h', 'extensions/extension_app_model_builder.cc', 'extensions/extensions_delegate.cc', + 'extensions/pubilc/apps_search_controller_factory.h', 'extensions/public/extension_app_model_builder.h', 'extensions/public/extensions_delegate.h', 'virtual_keyboard/public/virtual_keyboard_manager.h', @@ -191,12 +192,15 @@ 'sources': [ 'content/chrome/dialogs.cc', 'content/chrome/media_utils.cc', - 'content/chrome/scheme_classifier_factory.cc', 'content/chrome/web_activity_helpers.cc', + 'extensions/chrome/app_list_controller_delegate_athena.cc', + 'extensions/chrome/app_list_controller_delegate_athena.h', 'extensions/chrome/athena_chrome_app_delegate.cc', 'extensions/chrome/athena_chrome_app_delegate.h', 'extensions/chrome/athena_chrome_app_window_client.cc', 'extensions/chrome/athena_chrome_app_window_client.h', + 'extensions/chrome/chrome_search_controller_factory.cc', + 'extensions/chrome/chrome_search_controller_factory.h', 'extensions/chrome/extensions_delegate_impl.cc', ], }, @@ -212,14 +216,19 @@ 'sources': [ 'content/shell/dialogs.cc', 'content/shell/media_utils.cc', - 'content/shell/scheme_classifier_factory.cc', 'content/shell/web_activity_helpers.cc', 'extensions/shell/extensions_delegate_impl.cc', 'extensions/shell/athena_shell_app_delegate.cc', 'extensions/shell/athena_shell_app_delegate.h', 'extensions/shell/athena_shell_app_window_client.cc', 'extensions/shell/athena_shell_app_window_client.h', + 'extensions/shell/athena_shell_scheme_classifier.cc', + 'extensions/shell/athena_shell_scheme_classifier.h', 'extensions/shell/athena_apps_client_delegate.h', + 'extensions/shell/shell_search_controller_factory.cc', + 'extensions/shell/shell_search_controller_factory.h', + 'extensions/shell/url_search_provider.cc', + 'extensions/shell/url_search_provider.h', ], }, { diff --git a/athena/content/DEPS b/athena/content/DEPS index 32e80d0..2833f04 100644 --- a/athena/content/DEPS +++ b/athena/content/DEPS @@ -12,7 +12,6 @@ include_rules = [ "+components/renderer_context_menu", "+components/web_modal", "+content/public", - "+net/url_request", "+ui/aura", "+ui/base", "+ui/compositor", diff --git a/athena/content/chrome/scheme_classifier_factory.cc b/athena/content/chrome/scheme_classifier_factory.cc deleted file mode 100644 index 6e23df1..0000000 --- a/athena/content/chrome/scheme_classifier_factory.cc +++ /dev/null @@ -1,19 +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/content/public/scheme_classifier_factory.h" - -#include "chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.h" -#include "chrome/browser/profiles/profile.h" - -namespace athena { - -scoped_ptr<AutocompleteSchemeClassifier> CreateSchemeClassifier( - content::BrowserContext* context) { - return scoped_ptr<AutocompleteSchemeClassifier>( - new ChromeAutocompleteSchemeClassifier( - Profile::FromBrowserContext(context))); -} - -} // namespace athena diff --git a/athena/content/public/scheme_classifier_factory.h b/athena/content/public/scheme_classifier_factory.h deleted file mode 100644 index 272736e..0000000 --- a/athena/content/public/scheme_classifier_factory.h +++ /dev/null @@ -1,24 +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. - -#ifndef ATHENA_CONTENT_PUBLIC_SCHEME_CLASSIFIER_FACTORY_H_ -#define ATHENA_CONTENT_PUBLIC_SCHEME_CLASSIFIER_FACTORY_H_ - -#include "base/memory/scoped_ptr.h" -#include "components/omnibox/autocomplete_scheme_classifier.h" - -namespace content { -class BrowserContext; -} - -namespace athena { - -// Create the AutocompleteSchemeClassifier implementation of the current -// environment. -scoped_ptr<AutocompleteSchemeClassifier> CreateSchemeClassifier( - content::BrowserContext* context); - -} // namespace athena - -#endif // ATHENA_CONTENT_PUBLIC_SCHEME_CLASSIFIER_FACTORY_H_ diff --git a/athena/content/shell/scheme_classifier_factory.cc b/athena/content/shell/scheme_classifier_factory.cc deleted file mode 100644 index 922de5a..0000000 --- a/athena/content/shell/scheme_classifier_factory.cc +++ /dev/null @@ -1,40 +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/content/public/scheme_classifier_factory.h" - -#include "components/metrics/proto/omnibox_input_type.pb.h" -#include "net/url_request/url_request.h" - -namespace athena { - -namespace { - -// The AutocompleteSchemeClassifier implementation for athena_main. -class AthenaShellSchemeClassifier : public AutocompleteSchemeClassifier { - public: - AthenaShellSchemeClassifier() {} - virtual ~AthenaShellSchemeClassifier() {} - - // AutocompleteSchemeClassifier: - virtual metrics::OmniboxInputType::Type GetInputTypeForScheme( - const std::string& scheme) const override { - if (net::URLRequest::IsHandledProtocol(scheme)) - return metrics::OmniboxInputType::URL; - return metrics::OmniboxInputType::INVALID; - } - - private: - DISALLOW_COPY_AND_ASSIGN(AthenaShellSchemeClassifier); -}; - -} // namespace - -scoped_ptr<AutocompleteSchemeClassifier> CreateSchemeClassifier( - content::BrowserContext* context) { - return scoped_ptr<AutocompleteSchemeClassifier>( - new AthenaShellSchemeClassifier()); -} - -} // namespace athena diff --git a/athena/extensions/chrome/app_list_controller_delegate_athena.cc b/athena/extensions/chrome/app_list_controller_delegate_athena.cc new file mode 100644 index 0000000..5dcef059 --- /dev/null +++ b/athena/extensions/chrome/app_list_controller_delegate_athena.cc @@ -0,0 +1,114 @@ +// 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/chrome/app_list_controller_delegate_athena.h" + +#include "athena/activity/public/activity_factory.h" +#include "athena/extensions/public/extensions_delegate.h" +#include "chrome/browser/profiles/profile.h" +#include "extensions/common/extension.h" +#include "ui/app_list/views/app_list_view.h" + +namespace athena { + +AppListControllerDelegateAthena::AppListControllerDelegateAthena() { +} + +AppListControllerDelegateAthena::~AppListControllerDelegateAthena() { +} + +void AppListControllerDelegateAthena::DismissView() { +} + +gfx::NativeWindow AppListControllerDelegateAthena::GetAppListWindow() { + NOTIMPLEMENTED(); + return NULL; +} + +gfx::Rect AppListControllerDelegateAthena::GetAppListBounds() { + NOTIMPLEMENTED(); + return gfx::Rect(); +} + +gfx::ImageSkia AppListControllerDelegateAthena::GetWindowIcon() { + return gfx::ImageSkia(); +} + +bool AppListControllerDelegateAthena::IsAppPinned( + const std::string& extension_id) { + return false; +} + +void AppListControllerDelegateAthena::PinApp(const std::string& extension_id) { + NOTREACHED(); +} + +void AppListControllerDelegateAthena::UnpinApp( + const std::string& extension_id) { + NOTREACHED(); +} + +AppListControllerDelegate::Pinnable +AppListControllerDelegateAthena::GetPinnable() { + return NO_PIN; +} + +void AppListControllerDelegateAthena::OnShowChildDialog() { + NOTIMPLEMENTED(); +} + +void AppListControllerDelegateAthena::OnCloseChildDialog() { + NOTIMPLEMENTED(); +} + +bool AppListControllerDelegateAthena::CanDoCreateShortcutsFlow() { + return false; +} + +void AppListControllerDelegateAthena::DoCreateShortcutsFlow( + Profile* profile, + const std::string& extension_id) { + NOTREACHED(); +} + +void AppListControllerDelegateAthena::CreateNewWindow(Profile* profile, + bool incognito) { + // Nothing needs to be done. +} + +void AppListControllerDelegateAthena::OpenURL( + Profile* profile, + const GURL& url, + ui::PageTransition transition, + WindowOpenDisposition disposition) { + ActivityFactory::Get()->CreateWebActivity(profile, base::string16(), url); +} + +void AppListControllerDelegateAthena::ActivateApp( + Profile* profile, + const extensions::Extension* extension, + AppListSource source, + int event_flags) { + LaunchApp(profile, extension, source, event_flags); +} + +void AppListControllerDelegateAthena::LaunchApp( + Profile* profile, + const extensions::Extension* extension, + AppListSource source, + int event_flags) { + ExtensionsDelegate::Get(profile)->LaunchApp(extension->id()); +} + +void AppListControllerDelegateAthena::ShowForProfileByPath( + const base::FilePath& profile_path) { + // Ash doesn't have profile switching. + NOTREACHED(); +} + +bool AppListControllerDelegateAthena::ShouldShowUserIcon() { + return false; +} + +} // namespace athena diff --git a/athena/extensions/chrome/app_list_controller_delegate_athena.h b/athena/extensions/chrome/app_list_controller_delegate_athena.h new file mode 100644 index 0000000..78c6de1 --- /dev/null +++ b/athena/extensions/chrome/app_list_controller_delegate_athena.h @@ -0,0 +1,56 @@ +// 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. + +#ifndef ATHENA_EXTENSIONS_CHROME_APP_LIST_CONTROLLER_DELEGATE_ATHENA_H_ +#define ATHENA_EXTENSIONS_CHROME_APP_LIST_CONTROLLER_DELEGATE_ATHENA_H_ + +#include "base/basictypes.h" +#include "base/compiler_specific.h" +#include "chrome/browser/ui/app_list/app_list_controller_delegate.h" + +namespace athena { + +class AppListControllerDelegateAthena : public AppListControllerDelegate { + public: + AppListControllerDelegateAthena(); + virtual ~AppListControllerDelegateAthena(); + + private: + // AppListControllerDelegate overrides: + virtual void DismissView() override; + virtual gfx::NativeWindow GetAppListWindow() override; + virtual gfx::Rect GetAppListBounds() override; + virtual gfx::ImageSkia GetWindowIcon() override; + virtual bool IsAppPinned(const std::string& extension_id) override; + virtual void PinApp(const std::string& extension_id) override; + virtual void UnpinApp(const std::string& extension_id) override; + virtual Pinnable GetPinnable() override; + virtual void OnShowChildDialog() override; + virtual void OnCloseChildDialog() override; + virtual bool CanDoCreateShortcutsFlow() override; + virtual void DoCreateShortcutsFlow(Profile* profile, + const std::string& extension_id) override; + virtual void CreateNewWindow(Profile* profile, bool incognito) override; + virtual void OpenURL(Profile* profile, + const GURL& url, + ui::PageTransition transition, + WindowOpenDisposition disposition) override; + virtual void ActivateApp(Profile* profile, + const extensions::Extension* extension, + AppListSource source, + int event_flags) override; + virtual void LaunchApp(Profile* profile, + const extensions::Extension* extension, + AppListSource source, + int event_flags) override; + virtual void ShowForProfileByPath( + const base::FilePath& profile_path) override; + virtual bool ShouldShowUserIcon() override; + + DISALLOW_COPY_AND_ASSIGN(AppListControllerDelegateAthena); +}; + +} // namespace athena + +#endif // ATHENA_EXTENSIONS_CHROME_APP_LIST_CONTROLLER_DELEGATE_ATHENA_H_ diff --git a/athena/extensions/chrome/chrome_search_controller_factory.cc b/athena/extensions/chrome/chrome_search_controller_factory.cc new file mode 100644 index 0000000..d39c798 --- /dev/null +++ b/athena/extensions/chrome/chrome_search_controller_factory.cc @@ -0,0 +1,37 @@ +// 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/chrome/chrome_search_controller_factory.h" + +#include "athena/extensions/chrome/app_list_controller_delegate_athena.h" +#include "chrome/browser/profiles/profile.h" +#include "chrome/browser/ui/app_list/search/search_controller_factory.h" + +namespace athena { + +ChromeSearchControllerFactory::ChromeSearchControllerFactory( + content::BrowserContext* browser_context) + : browser_context_(browser_context) { +} + +ChromeSearchControllerFactory::~ChromeSearchControllerFactory() { +} + +scoped_ptr<app_list::SearchController> ChromeSearchControllerFactory::Create( + app_list::SearchBoxModel* search_box, + app_list::AppListModel::SearchResults* results) { + list_controller_.reset(new AppListControllerDelegateAthena()); + return app_list::CreateSearchController( + Profile::FromBrowserContext(browser_context_), + search_box, + results, + list_controller_.get()); +} + +scoped_ptr<SearchControllerFactory> CreateSearchControllerFactory( + content::BrowserContext* context) { + return make_scoped_ptr(new ChromeSearchControllerFactory(context)); +} + +} // namespace athena diff --git a/athena/extensions/chrome/chrome_search_controller_factory.h b/athena/extensions/chrome/chrome_search_controller_factory.h new file mode 100644 index 0000000..2525f79 --- /dev/null +++ b/athena/extensions/chrome/chrome_search_controller_factory.h @@ -0,0 +1,36 @@ +// 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. + +#ifndef ATHENA_EXTENSIONS_CHROME_CHROME_SEARCH_CONTROLLER_FACTORY_H_ +#define ATHENA_EXTENSIONS_CHROME_CHROME_SEARCH_CONTROLLER_FACTORY_H_ + +#include "athena/home/public/search_controller_factory.h" +#include "chrome/browser/ui/app_list/app_list_controller_delegate.h" + +namespace content { +class BrowserContext; +} + +namespace athena { + +class ChromeSearchControllerFactory : public SearchControllerFactory { + public: + explicit ChromeSearchControllerFactory( + content::BrowserContext* browser_context); + virtual ~ChromeSearchControllerFactory(); + + virtual scoped_ptr<app_list::SearchController> Create( + app_list::SearchBoxModel* search_box, + app_list::AppListModel::SearchResults* results) override; + + private: + content::BrowserContext* browser_context_; + scoped_ptr<AppListControllerDelegate> list_controller_; + + DISALLOW_COPY_AND_ASSIGN(ChromeSearchControllerFactory); +}; + +} // namespace athena + +#endif // ATHENA_EXTENSIONS_CHROME_CHROME_SEARCH_CONTROLLER_FACTORY_H_ diff --git a/athena/extensions/public/apps_search_controller_factory.h b/athena/extensions/public/apps_search_controller_factory.h new file mode 100644 index 0000000..f17e490 --- /dev/null +++ b/athena/extensions/public/apps_search_controller_factory.h @@ -0,0 +1,22 @@ +// 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. + +#ifndef ATHENA_EXTENSIONS_PUBLIC_APPS_SEARCH_CONTROLLER_FACTORY_H_ +#define ATHENA_EXTENSIONS_PUBLIC_APPS_SEARCH_CONTROLLER_FACTORY_H_ + +#include "athena/athena_export.h" + +namespace content { +class BrowserContext; +} + +namespace athena { +class SearchControllerFactory; + +ATHENA_EXPORT scoped_ptr<SearchControllerFactory> CreateSearchControllerFactory( + content::BrowserContext* context); + +} // namespace athena + +#endif // ATHENA_EXTENSIONS_PUBLIC_APPS_SEARCH_CONTROLLER_FACTORY_H_ diff --git a/athena/extensions/shell/DEPS b/athena/extensions/shell/DEPS index a8a0f03..28836ad 100644 --- a/athena/extensions/shell/DEPS +++ b/athena/extensions/shell/DEPS @@ -1,3 +1,8 @@ include_rules = [ + "+components/metrics/proto", + "+components/omnibox", + "+components/search_engines", "+extensions/shell/browser", + "+net/url_request", + "+ui/app_list", ] diff --git a/athena/extensions/shell/athena_shell_scheme_classifier.cc b/athena/extensions/shell/athena_shell_scheme_classifier.cc new file mode 100644 index 0000000..a66d373 --- /dev/null +++ b/athena/extensions/shell/athena_shell_scheme_classifier.cc @@ -0,0 +1,27 @@ +// 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/shell/athena_shell_scheme_classifier.h" + +#include "components/metrics/proto/omnibox_input_type.pb.h" +#include "net/url_request/url_request.h" + +using metrics::OmniboxInputType::Type; + +namespace athena { + +AthenaShellSchemeClassifier::AthenaShellSchemeClassifier() { +} + +AthenaShellSchemeClassifier::~AthenaShellSchemeClassifier() { +} + +Type AthenaShellSchemeClassifier::GetInputTypeForScheme( + const std::string& scheme) const { + if (net::URLRequest::IsHandledProtocol(scheme)) + return metrics::OmniboxInputType::URL; + return metrics::OmniboxInputType::INVALID; +} + +} // namespace athena diff --git a/athena/extensions/shell/athena_shell_scheme_classifier.h b/athena/extensions/shell/athena_shell_scheme_classifier.h new file mode 100644 index 0000000..4ab5dd7 --- /dev/null +++ b/athena/extensions/shell/athena_shell_scheme_classifier.h @@ -0,0 +1,29 @@ +// 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. + +#ifndef ATHENA_EXTENSIONS_SHELL_ATHENA_SHELL_SCHEME_CLASSIFIER_H_ +#define ATHENA_EXTENSIONS_SHELL_ATHENA_SHELL_SCHEME_CLASSIFIER_H_ + +#include "base/macros.h" +#include "components/omnibox/autocomplete_scheme_classifier.h" + +namespace athena { + +// The AutocompleteSchemeClassifier implementation for athena_main. +class AthenaShellSchemeClassifier : public AutocompleteSchemeClassifier { + public: + AthenaShellSchemeClassifier(); + virtual ~AthenaShellSchemeClassifier(); + + // AutocompleteSchemeClassifier: + virtual metrics::OmniboxInputType::Type GetInputTypeForScheme( + const std::string& scheme) const override; + + private: + DISALLOW_COPY_AND_ASSIGN(AthenaShellSchemeClassifier); +}; + +} // namespace athena + +#endif // ATHENA_EXTENSIONS_SHELL_ATHENA_SHELL_SCHEME_CLASSIFIER_H_ diff --git a/athena/extensions/shell/shell_search_controller_factory.cc b/athena/extensions/shell/shell_search_controller_factory.cc new file mode 100644 index 0000000..d8df1ec --- /dev/null +++ b/athena/extensions/shell/shell_search_controller_factory.cc @@ -0,0 +1,37 @@ +// 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/shell/shell_search_controller_factory.h" + +#include "athena/extensions/shell/url_search_provider.h" +#include "ui/app_list/search_controller.h" + +namespace athena { + +ShellSearchControllerFactory::ShellSearchControllerFactory( + content::BrowserContext* browser_context) + : browser_context_(browser_context) { +} + +ShellSearchControllerFactory::~ShellSearchControllerFactory() { +} + +scoped_ptr<app_list::SearchController> ShellSearchControllerFactory::Create( + app_list::SearchBoxModel* search_box, + app_list::AppListModel::SearchResults* results) { + scoped_ptr<app_list::SearchController> controller( + new app_list::SearchController( + search_box, results, NULL /* no history */)); + controller->AddProvider(app_list::Mixer::MAIN_GROUP, + scoped_ptr<app_list::SearchProvider>( + new UrlSearchProvider(browser_context_))); + return controller.Pass(); +} + +scoped_ptr<SearchControllerFactory> CreateSearchControllerFactory( + content::BrowserContext* context) { + return make_scoped_ptr(new ShellSearchControllerFactory(context)); +} + +} // namespace athena diff --git a/athena/extensions/shell/shell_search_controller_factory.h b/athena/extensions/shell/shell_search_controller_factory.h new file mode 100644 index 0000000..971f540 --- /dev/null +++ b/athena/extensions/shell/shell_search_controller_factory.h @@ -0,0 +1,34 @@ +// 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. + +#ifndef ATHENA_EXTENSIONS_SHELL_SHELL_SEARCH_CONTROLLER_FACTORY_H_ +#define ATHENA_EXTENSIONS_SHELL_SHELL_SEARCH_CONTROLLER_FACTORY_H_ + +#include "athena/home/public/search_controller_factory.h" + +namespace content { +class BrowserContext; +} + +namespace athena { + +class ShellSearchControllerFactory : public SearchControllerFactory { + public: + explicit ShellSearchControllerFactory( + content::BrowserContext* browser_context); + virtual ~ShellSearchControllerFactory(); + + virtual scoped_ptr<app_list::SearchController> Create( + app_list::SearchBoxModel* search_box, + app_list::AppListModel::SearchResults* results) override; + + private: + content::BrowserContext* browser_context_; + + DISALLOW_COPY_AND_ASSIGN(ShellSearchControllerFactory); +}; + +} // namespace athena + +#endif // ATHENA_EXTENSIONS_SHELL_SHELL_SEARCH_CONTROLLER_FACTORY_H_ diff --git a/athena/main/url_search_provider.cc b/athena/extensions/shell/url_search_provider.cc index bbb5b55..82dd2fa 100644 --- a/athena/main/url_search_provider.cc +++ b/athena/extensions/shell/url_search_provider.cc @@ -2,11 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "athena/main/url_search_provider.h" +#include "athena/extensions/shell/url_search_provider.h" #include "athena/activity/public/activity.h" #include "athena/activity/public/activity_factory.h" -#include "athena/content/public/scheme_classifier_factory.h" +#include "athena/extensions/shell/athena_shell_scheme_classifier.h" #include "base/strings/utf_string_conversions.h" #include "base/values.h" #include "components/metrics/proto/omnibox_event.pb.h" @@ -34,9 +34,7 @@ const int kScoreForWhatYouTypedResult = 1203; class AthenaSearchTermsData : public SearchTermsData { public: // SearchTermsData: - virtual std::string GetSuggestClient() const override { - return "chrome"; - } + virtual std::string GetSuggestClient() const override { return "chrome"; } }; // The templateURLServiceClient for Athena. Mainly for the interaction with @@ -67,8 +65,7 @@ class AthenaAutocompleteProviderClient : public AutocompleteProviderClient { public: explicit AthenaAutocompleteProviderClient( content::BrowserContext* browser_context) - : browser_context_(browser_context), - scheme_classifier_(CreateSchemeClassifier(browser_context)) {} + : browser_context_(browser_context) {} virtual ~AthenaAutocompleteProviderClient() {} virtual net::URLRequestContextGetter* RequestContext() override { @@ -84,7 +81,7 @@ class AthenaAutocompleteProviderClient : public AutocompleteProviderClient { virtual bool SearchSuggestEnabled() override { return true; } virtual bool ShowBookmarkBar() override { return false; } virtual const AutocompleteSchemeClassifier& SchemeClassifier() override { - return *scheme_classifier_; + return scheme_classifier_; } virtual void Classify( const base::string16& text, @@ -102,7 +99,7 @@ class AthenaAutocompleteProviderClient : public AutocompleteProviderClient { private: content::BrowserContext* browser_context_; - scoped_ptr<AutocompleteSchemeClassifier> scheme_classifier_; + AthenaShellSchemeClassifier scheme_classifier_; DISALLOW_COPY_AND_ASSIGN(AthenaAutocompleteProviderClient); }; @@ -120,10 +117,9 @@ int ACMatchStyleToTagStyle(int styles) { } // Translates ACMatchClassifications into SearchResult tags. -void ACMatchClassificationsToTags( - const base::string16& text, - const ACMatchClassifications& text_classes, - app_list::SearchResult::Tags* tags) { +void ACMatchClassificationsToTags(const base::string16& text, + const ACMatchClassifications& text_classes, + app_list::SearchResult::Tags* tags) { int tag_styles = app_list::SearchResult::Tag::NONE; size_t tag_start = 0; @@ -145,8 +141,8 @@ void ACMatchClassificationsToTags( } if (tag_styles != app_list::SearchResult::Tag::NONE) { - tags->push_back(app_list::SearchResult::Tag( - tag_styles, tag_start, text.length())); + tags->push_back( + app_list::SearchResult::Tag(tag_styles, tag_start, text.length())); } } @@ -154,8 +150,7 @@ class UrlSearchResult : public app_list::SearchResult { public: UrlSearchResult(content::BrowserContext* browser_context, const AutocompleteMatch& match) - : browser_context_(browser_context), - match_(match) { + : browser_context_(browser_context), match_(match) { set_id(match_.destination_url.spec()); // Derive relevance from omnibox relevance and normalize it to [0, 1]. @@ -189,16 +184,14 @@ class UrlSearchResult : public app_list::SearchResult { void UpdateTitleAndDetails() { set_title(match_.contents); SearchResult::Tags title_tags; - ACMatchClassificationsToTags(match_.contents, - match_.contents_class, - &title_tags); + ACMatchClassificationsToTags( + match_.contents, match_.contents_class, &title_tags); set_title_tags(title_tags); set_details(match_.description); SearchResult::Tags details_tags; - ACMatchClassificationsToTags(match_.description, - match_.description_class, - &details_tags); + ACMatchClassificationsToTags( + match_.description, match_.description_class, &details_tags); set_details_tags(details_tags); } @@ -213,16 +206,15 @@ class UrlSearchResult : public app_list::SearchResult { UrlSearchProvider::UrlSearchProvider(content::BrowserContext* browser_context) : browser_context_(browser_context), // TODO(mukai): introduce the real parameters when it's necessary. - template_url_service_( - new TemplateURLService(NULL /* prefs */, - scoped_ptr<SearchTermsData>( - new AthenaSearchTermsData()), - NULL /* KeywordWebDataService */, - scoped_ptr<TemplateURLServiceClient>( - new AthenaTemplateURLServiceClient()), - NULL /*GoogleURLTracker */, - NULL /* RapporService */, - base::Closure() /* dsp_change_callback */)), + template_url_service_(new TemplateURLService( + NULL /* prefs */, + scoped_ptr<SearchTermsData>(new AthenaSearchTermsData()), + NULL /* KeywordWebDataService */, + scoped_ptr<TemplateURLServiceClient>( + new AthenaTemplateURLServiceClient()), + NULL /*GoogleURLTracker */, + NULL /* RapporService */, + base::Closure() /* dsp_change_callback */)), provider_(new ::SearchProvider( this, template_url_service_.get(), @@ -236,8 +228,6 @@ UrlSearchProvider::~UrlSearchProvider() { void UrlSearchProvider::Start(const base::string16& query) { const bool minimal_changes = query == input_.text(); - scoped_ptr<AutocompleteSchemeClassifier> scheme_classifier( - CreateSchemeClassifier(browser_context_)); input_ = AutocompleteInput(query, base::string16::npos /* cursor_position */, std::string() /* desired_tld */, @@ -247,7 +237,7 @@ void UrlSearchProvider::Start(const base::string16& query) { false /* prefer_keyword */, true /* allow_extract_keyword_match */, true /* want_asynchronous_matches */, - *scheme_classifier); + AthenaShellSchemeClassifier()); // Clearing results here may cause unexpected results. // TODO(mukai): fix this by fixing crbug.com/415500 @@ -261,8 +251,8 @@ void UrlSearchProvider::Start(const base::string16& query) { what_you_typed_match.destination_url = input_.canonicalized_url(); what_you_typed_match.contents = input_.text(); what_you_typed_match.relevance = kScoreForWhatYouTypedResult; - Add(scoped_ptr<app_list::SearchResult>(new UrlSearchResult( - browser_context_, what_you_typed_match))); + Add(scoped_ptr<app_list::SearchResult>( + new UrlSearchResult(browser_context_, what_you_typed_match))); } provider_->Start(input_, minimal_changes); @@ -282,8 +272,8 @@ void UrlSearchProvider::OnProviderUpdate(bool updated_matches) { if (!it->destination_url.is_valid()) continue; - Add(scoped_ptr<app_list::SearchResult>(new UrlSearchResult( - browser_context_, *it))); + Add(scoped_ptr<app_list::SearchResult>( + new UrlSearchResult(browser_context_, *it))); } } diff --git a/athena/main/url_search_provider.h b/athena/extensions/shell/url_search_provider.h index 354e462..95026d9 100644 --- a/athena/main/url_search_provider.h +++ b/athena/extensions/shell/url_search_provider.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef ATHENA_MAIN_URL_SEARCH_PROVIDER_H_ -#define ATHENA_MAIN_URL_SEARCH_PROVIDER_H_ +#ifndef ATHENA_EXTENSIONS_SHELL_URL_SEARCH_PROVIDER_H_ +#define ATHENA_EXTENSIONS_SHELL_URL_SEARCH_PROVIDER_H_ #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" @@ -48,4 +48,4 @@ class UrlSearchProvider : public app_list::SearchProvider, } // namespace athena -#endif // ATHENA_MAIN_URL_SEARCH_PROVIDER_H_ +#endif // ATHENA_EXTENSIONS_SHELL_URL_SEARCH_PROVIDER_H_ diff --git a/athena/home/app_list_view_delegate.cc b/athena/home/app_list_view_delegate.cc index 29ecb05..bb1e0be 100644 --- a/athena/home/app_list_view_delegate.cc +++ b/athena/home/app_list_view_delegate.cc @@ -8,6 +8,7 @@ #include <vector> #include "athena/home/public/app_model_builder.h" +#include "athena/home/public/search_controller_factory.h" #include "athena/strings/grit/athena_strings.h" #include "base/basictypes.h" #include "base/bind.h" @@ -16,6 +17,7 @@ #include "third_party/skia/include/core/SkBitmap.h" #include "ui/app_list/app_list_model.h" #include "ui/app_list/search_box_model.h" +#include "ui/app_list/search_controller.h" #include "ui/app_list/search_provider.h" #include "ui/app_list/search_result.h" #include "ui/app_list/speech_ui_model.h" @@ -27,36 +29,21 @@ namespace athena { -AppListViewDelegate::AppListViewDelegate(AppModelBuilder* model_builder) +AppListViewDelegate::AppListViewDelegate( + AppModelBuilder* model_builder, + SearchControllerFactory* search_factory) : model_(new app_list::AppListModel), speech_ui_(new app_list::SpeechUIModel) { model_builder->PopulateApps(model_.get()); model_->search_box()->SetHintText( l10n_util::GetStringUTF16(IDS_ATHENA_SEARCH_BOX_HINT)); + if (search_factory) { + search_controller_ = + search_factory->Create(model_->search_box(), model_->results()); + } } AppListViewDelegate::~AppListViewDelegate() { - for (size_t i = 0; i < search_providers_.size(); ++i) - search_providers_[i]->set_result_changed_callback(base::Closure()); -} - -void AppListViewDelegate::RegisterSearchProvider( - app_list::SearchProvider* search_provider) { - // Right now we allow only one provider. - // TODO(mukai): port app-list's mixer and remove this restriction. - DCHECK(search_providers_.empty()); - search_provider->set_result_changed_callback(base::Bind( - &AppListViewDelegate::SearchResultChanged, base::Unretained(this))); - search_providers_.push_back(search_provider); -} - -void AppListViewDelegate::SearchResultChanged() { - // TODO(mukai): port app-list's Mixer to reorder the results properly. - app_list::SearchProvider* search_provider = search_providers_[0]; - const app_list::SearchProvider::Results& results = search_provider->results(); - model_->results()->DeleteAll(); - for (size_t i = 0; i < results.size(); ++i) - model_->results()->Add(results[i]->Duplicate().release()); } bool AppListViewDelegate::ForceNativeDesktop() const { @@ -82,26 +69,28 @@ void AppListViewDelegate::GetShortcutPathForApp( } void AppListViewDelegate::StartSearch() { - for (size_t i = 0; i < search_providers_.size(); ++i) - search_providers_[i]->Start(model_->search_box()->text()); + if (search_controller_) + search_controller_->Start(); } void AppListViewDelegate::StopSearch() { - for (size_t i = 0; i < search_providers_.size(); ++i) - search_providers_[i]->Stop(); + if (search_controller_) + search_controller_->Stop(); } void AppListViewDelegate::OpenSearchResult(app_list::SearchResult* result, bool auto_launch, int event_flags) { - result->Open(event_flags); + if (search_controller_) + search_controller_->OpenResult(result, event_flags); } void AppListViewDelegate::InvokeSearchResultAction( app_list::SearchResult* result, int action_index, int event_flags) { - // TODO(mukai): implement this. + if (search_controller_) + search_controller_->InvokeResultAction(result, action_index, event_flags); } base::TimeDelta AppListViewDelegate::GetAutoLaunchTimeout() { diff --git a/athena/home/app_list_view_delegate.h b/athena/home/app_list_view_delegate.h index 8bf25d5..d5a1321 100644 --- a/athena/home/app_list_view_delegate.h +++ b/athena/home/app_list_view_delegate.h @@ -10,22 +10,20 @@ #include "ui/app_list/app_list_view_delegate.h" namespace app_list { -class SearchProvider; +class SearchController; } namespace athena { class AppModelBuilder; +class SearchControllerFactory; class AppListViewDelegate : public app_list::AppListViewDelegate { public: - explicit AppListViewDelegate(AppModelBuilder* model_builder); + AppListViewDelegate(AppModelBuilder* model_builder, + SearchControllerFactory* search_factory); virtual ~AppListViewDelegate(); - void RegisterSearchProvider(app_list::SearchProvider* search_provider); - private: - void SearchResultChanged(); - // Overridden from app_list::AppListViewDelegate: virtual bool ForceNativeDesktop() const override; virtual void SetProfileByPath(const base::FilePath& profile_path) override; @@ -64,8 +62,7 @@ class AppListViewDelegate : public app_list::AppListViewDelegate { scoped_ptr<app_list::AppListModel> model_; scoped_ptr<app_list::SpeechUIModel> speech_ui_; Users users_; - - std::vector<app_list::SearchProvider*> search_providers_; + scoped_ptr<app_list::SearchController> search_controller_; DISALLOW_COPY_AND_ASSIGN(AppListViewDelegate); }; diff --git a/athena/home/home_card_impl.cc b/athena/home/home_card_impl.cc index c96af41..1ffbfbf 100644 --- a/athena/home/home_card_impl.cc +++ b/athena/home/home_card_impl.cc @@ -16,7 +16,6 @@ #include "athena/screen/public/screen_manager.h" #include "athena/util/container_priorities.h" #include "athena/wm/public/window_manager.h" -#include "ui/app_list/search_provider.h" #include "ui/app_list/views/app_list_main_view.h" #include "ui/app_list/views/contents_view.h" #include "ui/aura/layout_manager.h" @@ -222,8 +221,10 @@ class HomeCardView : public views::WidgetDelegateView { DISALLOW_COPY_AND_ASSIGN(HomeCardView); }; -HomeCardImpl::HomeCardImpl(AppModelBuilder* model_builder) - : model_builder_(model_builder), +HomeCardImpl::HomeCardImpl(scoped_ptr<AppModelBuilder> model_builder, + scoped_ptr<SearchControllerFactory> search_factory) + : model_builder_(model_builder.Pass()), + search_factory_(search_factory.Pass()), state_(HIDDEN), original_state_(VISIBLE_MINIMIZED), home_card_widget_(NULL), @@ -245,7 +246,6 @@ HomeCardImpl::~HomeCardImpl() { // Reset the view delegate first as it access search provider during // shutdown. view_delegate_.reset(); - search_provider_.reset(); instance = NULL; } @@ -259,9 +259,8 @@ void HomeCardImpl::Init() { container->SetLayoutManager(layout_manager_); wm::SetChildWindowVisibilityChangesAnimated(container); - view_delegate_.reset(new AppListViewDelegate(model_builder_.get())); - if (search_provider_) - view_delegate_->RegisterSearchProvider(search_provider_.get()); + view_delegate_.reset( + new AppListViewDelegate(model_builder_.get(), search_factory_.get())); home_card_view_ = new HomeCardView(view_delegate_.get(), container, this); home_card_widget_ = new views::Widget(); @@ -339,13 +338,6 @@ HomeCard::State HomeCardImpl::GetState() { return state_; } -void HomeCardImpl::RegisterSearchProvider( - app_list::SearchProvider* search_provider) { - DCHECK(!search_provider_); - search_provider_.reset(search_provider); - view_delegate_->RegisterSearchProvider(search_provider_.get()); -} - void HomeCardImpl::UpdateVirtualKeyboardBounds( const gfx::Rect& bounds) { if (state_ == VISIBLE_MINIMIZED && !bounds.IsEmpty()) { @@ -437,8 +429,9 @@ void HomeCardImpl::OnWindowActivated(aura::Window* gained_active, } // static -HomeCard* HomeCard::Create(AppModelBuilder* model_builder) { - (new HomeCardImpl(model_builder))->Init(); +HomeCard* HomeCard::Create(scoped_ptr<AppModelBuilder> model_builder, + scoped_ptr<SearchControllerFactory> search_factory) { + (new HomeCardImpl(model_builder.Pass(), search_factory.Pass()))->Init(); DCHECK(instance); return instance; } diff --git a/athena/home/home_card_impl.h b/athena/home/home_card_impl.h index 0f7b330..98ea3a6 100644 --- a/athena/home/home_card_impl.h +++ b/athena/home/home_card_impl.h @@ -8,14 +8,11 @@ #include "athena/athena_export.h" #include "athena/home/home_card_gesture_manager.h" #include "athena/home/public/home_card.h" +#include "athena/home/public/search_controller_factory.h" #include "athena/input/public/accelerator_manager.h" #include "athena/wm/public/window_manager_observer.h" #include "ui/wm/public/activation_change_observer.h" -namespace app_list { -class SearchProvider; -} - namespace aura { class Window; @@ -49,7 +46,8 @@ class ATHENA_EXPORT HomeCardImpl public WindowManagerObserver, public aura::client::ActivationChangeObserver { public: - explicit HomeCardImpl(AppModelBuilder* model_builder); + HomeCardImpl(scoped_ptr<AppModelBuilder> model_builder, + scoped_ptr<SearchControllerFactory> search_factory); virtual ~HomeCardImpl(); void Init(); @@ -65,8 +63,6 @@ class ATHENA_EXPORT HomeCardImpl // Overridden from HomeCard: virtual void SetState(HomeCard::State state) override; virtual State GetState() override; - virtual void RegisterSearchProvider( - app_list::SearchProvider* search_provider) override; virtual void UpdateVirtualKeyboardBounds( const gfx::Rect& bounds) override; @@ -94,6 +90,7 @@ class ATHENA_EXPORT HomeCardImpl aura::Window* lost_active) override; scoped_ptr<AppModelBuilder> model_builder_; + scoped_ptr<SearchControllerFactory> search_factory_; HomeCard::State state_; @@ -108,10 +105,6 @@ class ATHENA_EXPORT HomeCardImpl aura::client::ActivationClient* activation_client_; // Not owned scoped_ptr<ui::LayerOwner> minimized_home_; - // Right now HomeCard allows only one search provider. - // TODO(mukai): port app-list's SearchController and Mixer. - scoped_ptr<app_list::SearchProvider> search_provider_; - DISALLOW_COPY_AND_ASSIGN(HomeCardImpl); }; diff --git a/athena/home/public/home_card.h b/athena/home/public/home_card.h index 5f3c1b2..4715119 100644 --- a/athena/home/public/home_card.h +++ b/athena/home/public/home_card.h @@ -6,10 +6,7 @@ #define ATHENA_HOME_PUBLIC_HOME_CARD_H_ #include "athena/athena_export.h" - -namespace app_list { -class SearchProvider; -} +#include "base/memory/scoped_ptr.h" namespace gfx { class Rect; @@ -17,6 +14,7 @@ class Rect; namespace athena { class AppModelBuilder; +class SearchControllerFactory; class ATHENA_EXPORT HomeCard { public: @@ -38,7 +36,8 @@ class ATHENA_EXPORT HomeCard { // Creates/deletes/gets the singleton object of the HomeCard // implementation. Takes the ownership of |model_builder|. - static HomeCard* Create(AppModelBuilder* model_builder); + static HomeCard* Create(scoped_ptr<AppModelBuilder> model_builder, + scoped_ptr<SearchControllerFactory> search_factory); static void Shutdown(); static HomeCard* Get(); @@ -48,11 +47,6 @@ class ATHENA_EXPORT HomeCard { virtual void SetState(State state) = 0; virtual State GetState() = 0; - // Registers a search_provider to the HomeCard. Receiver will take - // the ownership of the specified provider. - virtual void RegisterSearchProvider( - app_list::SearchProvider* search_provider) = 0; - // Called when the virtual keyboard changed has changed to |bounds|. An empty // |bounds| indicates that the virtual keyboard is not visible anymore. virtual void UpdateVirtualKeyboardBounds( diff --git a/athena/home/public/search_controller_factory.h b/athena/home/public/search_controller_factory.h new file mode 100644 index 0000000..b004b38 --- /dev/null +++ b/athena/home/public/search_controller_factory.h @@ -0,0 +1,29 @@ +// 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. + +#ifndef ATHENA_HOME_PUBLIC_SEARCH_CONTROLLER_FACTORY_H_ +#define ATHENA_HOME_PUBLIC_SEARCH_CONTROLLER_FACTORY_H_ + +#include "athena/athena_export.h" +#include "ui/app_list/app_list_model.h" +#include "ui/app_list/search_controller.h" + +namespace app_list { +class SearchBoxModel; +} + +namespace athena { + +class ATHENA_EXPORT SearchControllerFactory { + public: + virtual ~SearchControllerFactory() {} + + virtual scoped_ptr<app_list::SearchController> Create( + app_list::SearchBoxModel* search_box, + app_list::AppListModel::SearchResults* results) = 0; +}; + +} // namespace athena + +#endif // ATHENA_HOME_PUBLIC_SEARCH_CONTROLLER_FACTORY_H_ diff --git a/athena/main/DEPS b/athena/main/DEPS index 3c29e06..b836eac 100644 --- a/athena/main/DEPS +++ b/athena/main/DEPS @@ -12,10 +12,7 @@ include_rules = [ "+athena/task/public", "+athena/virtual_keyboard/public", "+athena/wm/public", - "+components/metrics/proto", - "+components/omnibox", "+components/pdf", - "+components/search_engines", "+content/public", "+net", "+ppapi", diff --git a/athena/main/athena_launcher.cc b/athena/main/athena_launcher.cc index e85327f..77bf29e 100644 --- a/athena/main/athena_launcher.cc +++ b/athena/main/athena_launcher.cc @@ -9,14 +9,15 @@ #include "athena/content/public/app_registry.h" #include "athena/content/public/content_activity_factory_creator.h" #include "athena/env/public/athena_env.h" +#include "athena/extensions/public/apps_search_controller_factory.h" #include "athena/extensions/public/extension_app_model_builder.h" #include "athena/extensions/public/extensions_delegate.h" #include "athena/home/public/home_card.h" +#include "athena/home/public/search_controller_factory.h" #include "athena/input/public/input_manager.h" #include "athena/main/athena_views_delegate.h" #include "athena/main/placeholder.h" #include "athena/main/placeholder.h" -#include "athena/main/url_search_provider.h" #include "athena/resource_manager/public/resource_manager.h" #include "athena/screen/public/screen_manager.h" #include "athena/system/public/system_ui.h" @@ -128,10 +129,10 @@ void CreateVirtualKeyboardWithContext(content::BrowserContext* context) { void StartAthenaSessionWithContext(content::BrowserContext* context) { athena::ExtensionsDelegate::CreateExtensionsDelegate(context); - StartAthenaSession(athena::CreateContentActivityFactory(), - new athena::ExtensionAppModelBuilder(context)); - athena::HomeCard::Get()->RegisterSearchProvider( - new athena::UrlSearchProvider(context)); + StartAthenaSession( + athena::CreateContentActivityFactory(), + make_scoped_ptr(new athena::ExtensionAppModelBuilder(context)), + athena::CreateSearchControllerFactory(context)); AthenaEnvState* env_state = athena::ScreenManager::Get()->GetContext()->GetProperty( kAthenaEnvStateKey); @@ -140,11 +141,13 @@ void StartAthenaSessionWithContext(content::BrowserContext* context) { CreateTestPages(context); } -void StartAthenaSession(athena::ActivityFactory* activity_factory, - athena::AppModelBuilder* app_model_builder) { +void StartAthenaSession( + athena::ActivityFactory* activity_factory, + scoped_ptr<athena::AppModelBuilder> app_model_builder, + scoped_ptr<athena::SearchControllerFactory> search_factory) { DCHECK(!session_started); session_started = true; - athena::HomeCard::Create(app_model_builder); + athena::HomeCard::Create(app_model_builder.Pass(), search_factory.Pass()); athena::ActivityManager::Create(); athena::ResourceManager::Create(); athena::ActivityFactory::RegisterActivityFactory(activity_factory); diff --git a/athena/main/athena_main.gyp b/athena/main/athena_main.gyp index 9dd5afe..24b3274 100644 --- a/athena/main/athena_main.gyp +++ b/athena/main/athena_main.gyp @@ -46,8 +46,6 @@ 'placeholder.cc', 'placeholder.h', 'public/athena_launcher.h', - 'url_search_provider.cc', - 'url_search_provider.h', ], }, { diff --git a/athena/main/public/athena_launcher.h b/athena/main/public/athena_launcher.h index 550dce3..732129c 100644 --- a/athena/main/public/athena_launcher.h +++ b/athena/main/public/athena_launcher.h @@ -6,6 +6,7 @@ #define ATHENA_MAIN_PUBLIC_ATHENA_LAUNCHER_H_ #include "base/memory/ref_counted.h" +#include "base/memory/scoped_ptr.h" namespace base { class TaskRunner; @@ -22,6 +23,7 @@ class BrowserContext; namespace athena { class ActivityFactory; class AppModelBuilder; +class SearchControllerFactory; // Starts down the athena shell environment. void StartAthenaEnv(scoped_refptr<base::TaskRunner> file_runner); @@ -32,7 +34,8 @@ void CreateVirtualKeyboardWithContext(content::BrowserContext* context); // Starts the athena session. void StartAthenaSession(ActivityFactory* activity_factory, - AppModelBuilder* app_model_builder); + scoped_ptr<AppModelBuilder> app_model_builder, + scoped_ptr<SearchControllerFactory> search_factory); void ShutdownAthena(); diff --git a/athena/test/base/athena_test_helper.cc b/athena/test/base/athena_test_helper.cc index a46559e..dd9177e 100644 --- a/athena/test/base/athena_test_helper.cc +++ b/athena/test/base/athena_test_helper.cc @@ -5,7 +5,9 @@ #include "athena/test/base/athena_test_helper.h" #include "athena/env/public/athena_env.h" +#include "athena/extensions/public/apps_search_controller_factory.h" #include "athena/extensions/public/extensions_delegate.h" +#include "athena/home/public/search_controller_factory.h" #include "athena/main/public/athena_launcher.h" #include "athena/test/base/sample_activity_factory.h" #include "athena/test/base/test_app_model_builder.h" @@ -64,7 +66,8 @@ void AthenaTestHelper::SetUp(ui::ContextFactory* context_factory) { athena::StartAthenaEnv(file_thread_->message_loop_proxy()); athena::ExtensionsDelegate::CreateExtensionsDelegateForTest(); athena::StartAthenaSession(new SampleActivityFactory(), - new TestAppModelBuilder()); + make_scoped_ptr(new TestAppModelBuilder()), + CreateSearchControllerFactory(NULL)); } void AthenaTestHelper::TearDown() { diff --git a/chrome/browser/ui/app_list/search/app_result.cc b/chrome/browser/ui/app_list/search/app_result.cc index 4f628b3..e282aa8 100644 --- a/chrome/browser/ui/app_list/search/app_result.cc +++ b/chrome/browser/ui/app_list/search/app_result.cc @@ -38,8 +38,12 @@ AppResult::AppResult(Profile* profile, controller_(controller), extension_registry_(NULL) { set_id(extensions::Extension::GetBaseURLFromExtensionId(app_id_).spec()); +#if !defined(USE_ATHENA) + // TODO(mukai): Athena also needs to use tile-styled search results for apps. + // Implement it and then remove this ifdef. if (app_list::switches::IsExperimentalAppListEnabled()) set_display_type(DISPLAY_TILE); +#endif const extensions::Extension* extension = extensions::ExtensionSystem::Get(profile_)->extension_service() |