| 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/extension_web_ui.h" | 5 #include "chrome/browser/extensions/extension_web_ui.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| 11 #include "base/utf_string_conversions.h" | 11 #include "base/utf_string_conversions.h" |
| 12 #include "chrome/browser/bookmarks/bookmark_manager_extension_api.h" | 12 #include "chrome/browser/bookmarks/bookmark_manager_extension_api.h" |
| 13 #include "chrome/browser/extensions/extension_service.h" | 13 #include "chrome/browser/extensions/extension_service.h" |
| 14 #include "chrome/browser/extensions/image_loading_tracker.h" | 14 #include "chrome/browser/extensions/image_loading_tracker.h" |
| 15 #include "chrome/browser/prefs/pref_service.h" | 15 #include "chrome/browser/prefs/pref_service.h" |
| 16 #include "chrome/browser/prefs/scoped_user_pref_update.h" | 16 #include "chrome/browser/prefs/scoped_user_pref_update.h" |
| 17 #include "chrome/browser/profiles/profile.h" | 17 #include "chrome/browser/profiles/profile.h" |
| 18 #include "chrome/browser/ui/browser.h" | 18 #include "chrome/browser/ui/browser.h" |
| 19 #include "chrome/browser/ui/tab_contents/tab_contents.h" |
| 19 #include "chrome/browser/ui/tab_contents/tab_contents_iterator.h" | 20 #include "chrome/browser/ui/tab_contents/tab_contents_iterator.h" |
| 20 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | |
| 21 #include "chrome/common/chrome_switches.h" | 21 #include "chrome/common/chrome_switches.h" |
| 22 #include "chrome/common/extensions/extension.h" | 22 #include "chrome/common/extensions/extension.h" |
| 23 #include "chrome/common/extensions/extension_constants.h" | 23 #include "chrome/common/extensions/extension_constants.h" |
| 24 #include "chrome/common/extensions/extension_icon_set.h" | 24 #include "chrome/common/extensions/extension_icon_set.h" |
| 25 #include "chrome/common/extensions/extension_resource.h" | 25 #include "chrome/common/extensions/extension_resource.h" |
| 26 #include "chrome/common/url_constants.h" | 26 #include "chrome/common/url_constants.h" |
| 27 #include "content/public/browser/navigation_controller.h" | 27 #include "content/public/browser/navigation_controller.h" |
| 28 #include "content/public/browser/web_contents.h" | 28 #include "content/public/browser/web_contents.h" |
| 29 #include "content/public/browser/web_ui.h" | 29 #include "content/public/browser/web_ui.h" |
| 30 #include "content/public/common/bindings_policy.h" | 30 #include "content/public/common/bindings_policy.h" |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 } | 163 } |
| 164 } | 164 } |
| 165 | 165 |
| 166 if (should_hide_url) | 166 if (should_hide_url) |
| 167 web_ui->HideURL(); | 167 web_ui->HideURL(); |
| 168 | 168 |
| 169 web_ui->SetBindings(bindings); | 169 web_ui->SetBindings(bindings); |
| 170 | 170 |
| 171 // Hack: A few things we specialize just for the bookmark manager. | 171 // Hack: A few things we specialize just for the bookmark manager. |
| 172 if (extension->id() == extension_misc::kBookmarkManagerId) { | 172 if (extension->id() == extension_misc::kBookmarkManagerId) { |
| 173 TabContentsWrapper* tab = TabContentsWrapper::GetCurrentWrapperForContents( | 173 TabContents* tab = TabContents::FromWebContents(web_ui->GetWebContents()); |
| 174 web_ui->GetWebContents()); | |
| 175 DCHECK(tab); | 174 DCHECK(tab); |
| 176 bookmark_manager_extension_event_router_.reset( | 175 bookmark_manager_extension_event_router_.reset( |
| 177 new BookmarkManagerExtensionEventRouter(profile, tab)); | 176 new BookmarkManagerExtensionEventRouter(profile, tab)); |
| 178 | 177 |
| 179 web_ui->SetLinkTransitionType(content::PAGE_TRANSITION_AUTO_BOOKMARK); | 178 web_ui->SetLinkTransitionType(content::PAGE_TRANSITION_AUTO_BOOKMARK); |
| 180 } | 179 } |
| 181 } | 180 } |
| 182 | 181 |
| 183 ExtensionWebUI::~ExtensionWebUI() {} | 182 ExtensionWebUI::~ExtensionWebUI() {} |
| 184 | 183 |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 416 } | 415 } |
| 417 | 416 |
| 418 // static | 417 // static |
| 419 void ExtensionWebUI::GetFaviconForURL(Profile* profile, | 418 void ExtensionWebUI::GetFaviconForURL(Profile* profile, |
| 420 FaviconService::GetFaviconRequest* request, const GURL& page_url) { | 419 FaviconService::GetFaviconRequest* request, const GURL& page_url) { |
| 421 // tracker deletes itself when done. | 420 // tracker deletes itself when done. |
| 422 ExtensionWebUIImageLoadingTracker* tracker = | 421 ExtensionWebUIImageLoadingTracker* tracker = |
| 423 new ExtensionWebUIImageLoadingTracker(profile, request, page_url); | 422 new ExtensionWebUIImageLoadingTracker(profile, request, page_url); |
| 424 tracker->Init(); | 423 tracker->Init(); |
| 425 } | 424 } |
| OLD | NEW |