Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/tab_contents/tab_contents.h" | 5 #include "chrome/browser/tab_contents/tab_contents.h" |
| 6 | 6 |
| 7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
| 8 #include "app/resource_bundle.h" | 8 #include "app/resource_bundle.h" |
| 9 #include "base/file_version_info.h" | 9 #include "base/file_version_info.h" |
| 10 #include "base/process_util.h" | 10 #include "base/process_util.h" |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 38 #include "chrome/browser/tab_contents/infobar_delegate.h" | 38 #include "chrome/browser/tab_contents/infobar_delegate.h" |
| 39 #include "chrome/browser/tab_contents/interstitial_page.h" | 39 #include "chrome/browser/tab_contents/interstitial_page.h" |
| 40 #include "chrome/browser/tab_contents/navigation_entry.h" | 40 #include "chrome/browser/tab_contents/navigation_entry.h" |
| 41 #include "chrome/browser/tab_contents/provisional_load_details.h" | 41 #include "chrome/browser/tab_contents/provisional_load_details.h" |
| 42 #include "chrome/browser/tab_contents/tab_contents_delegate.h" | 42 #include "chrome/browser/tab_contents/tab_contents_delegate.h" |
| 43 #include "chrome/browser/tab_contents/tab_contents_view.h" | 43 #include "chrome/browser/tab_contents/tab_contents_view.h" |
| 44 #include "chrome/browser/tab_contents/thumbnail_generator.h" | 44 #include "chrome/browser/tab_contents/thumbnail_generator.h" |
| 45 #include "chrome/browser/thumbnail_store.h" | 45 #include "chrome/browser/thumbnail_store.h" |
| 46 #include "chrome/browser/search_engines/template_url_fetcher.h" | 46 #include "chrome/browser/search_engines/template_url_fetcher.h" |
| 47 #include "chrome/browser/search_engines/template_url_model.h" | 47 #include "chrome/browser/search_engines/template_url_model.h" |
| 48 #include "chrome/browser/shell_integration.h" | |
| 48 #include "chrome/common/chrome_switches.h" | 49 #include "chrome/common/chrome_switches.h" |
| 49 #include "chrome/common/notification_service.h" | 50 #include "chrome/common/notification_service.h" |
| 50 #include "chrome/common/page_action.h" | 51 #include "chrome/common/page_action.h" |
| 51 #include "chrome/common/pref_names.h" | 52 #include "chrome/common/pref_names.h" |
| 52 #include "chrome/common/pref_service.h" | 53 #include "chrome/common/pref_service.h" |
| 53 #include "chrome/common/render_messages.h" | 54 #include "chrome/common/render_messages.h" |
| 54 #include "chrome/common/renderer_preferences.h" | 55 #include "chrome/common/renderer_preferences.h" |
| 55 #include "chrome/common/url_constants.h" | 56 #include "chrome/common/url_constants.h" |
| 56 #include "grit/generated_resources.h" | 57 #include "grit/generated_resources.h" |
| 57 #include "grit/locale_settings.h" | 58 #include "grit/locale_settings.h" |
| (...skipping 678 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 736 MSG_ROUTING_NONE, NULL); | 737 MSG_ROUTING_NONE, NULL); |
| 737 tc->controller().CopyStateFrom(controller_); | 738 tc->controller().CopyStateFrom(controller_); |
| 738 return tc; | 739 return tc; |
| 739 } | 740 } |
| 740 | 741 |
| 741 void TabContents::CreateShortcut() { | 742 void TabContents::CreateShortcut() { |
| 742 NavigationEntry* entry = controller_.GetLastCommittedEntry(); | 743 NavigationEntry* entry = controller_.GetLastCommittedEntry(); |
| 743 if (!entry) | 744 if (!entry) |
| 744 return; | 745 return; |
| 745 | 746 |
| 747 #if defined(OS_LINUX) | |
| 748 // TODO(phajdan.jr): Finish creating shortcuts (UI etc). | |
|
Evan Martin
2009/08/14 18:29:22
maybe stick a NOTIMPLEMENTED() in here so it doesn
| |
| 749 ShellIntegration::CreateDesktopShortcut(GetURL(), GetTitle()); | |
| 750 #else | |
| 746 // We only allow one pending install request. By resetting the page id we | 751 // We only allow one pending install request. By resetting the page id we |
| 747 // effectively cancel the pending install request. | 752 // effectively cancel the pending install request. |
| 748 pending_install_.page_id = entry->page_id(); | 753 pending_install_.page_id = entry->page_id(); |
| 749 pending_install_.icon = GetFavIcon(); | 754 pending_install_.icon = GetFavIcon(); |
| 750 pending_install_.title = UTF16ToWideHack(GetTitle()); | 755 pending_install_.title = UTF16ToWideHack(GetTitle()); |
| 751 pending_install_.url = GetURL(); | 756 pending_install_.url = GetURL(); |
| 752 if (pending_install_.callback_functor) { | 757 if (pending_install_.callback_functor) { |
| 753 pending_install_.callback_functor->Cancel(); | 758 pending_install_.callback_functor->Cancel(); |
| 754 pending_install_.callback_functor = NULL; | 759 pending_install_.callback_functor = NULL; |
| 755 } | 760 } |
| 756 DCHECK(!pending_install_.icon.isNull()) << "Menu item should be disabled."; | 761 DCHECK(!pending_install_.icon.isNull()) << "Menu item should be disabled."; |
| 757 if (pending_install_.title.empty()) | 762 if (pending_install_.title.empty()) |
| 758 pending_install_.title = UTF8ToWide(GetURL().spec()); | 763 pending_install_.title = UTF8ToWide(GetURL().spec()); |
| 759 | 764 |
| 760 // Request the application info. When done OnDidGetApplicationInfo is invoked | 765 // Request the application info. When done OnDidGetApplicationInfo is invoked |
| 761 // and we'll create the shortcut. | 766 // and we'll create the shortcut. |
| 762 render_view_host()->GetApplicationInfo(pending_install_.page_id); | 767 render_view_host()->GetApplicationInfo(pending_install_.page_id); |
| 768 #endif | |
| 763 } | 769 } |
| 764 | 770 |
| 765 void TabContents::ShowPageInfo(const GURL& url, | 771 void TabContents::ShowPageInfo(const GURL& url, |
| 766 const NavigationEntry::SSLStatus& ssl, | 772 const NavigationEntry::SSLStatus& ssl, |
| 767 bool show_history) { | 773 bool show_history) { |
| 768 if (!delegate_) | 774 if (!delegate_) |
| 769 return; | 775 return; |
| 770 | 776 |
| 771 delegate_->ShowPageInfo(profile(), url, ssl, show_history); | 777 delegate_->ShowPageInfo(profile(), url, ssl, show_history); |
| 772 } | 778 } |
| (...skipping 1628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2401 NavigationController::LoadCommittedDetails& committed_details = | 2407 NavigationController::LoadCommittedDetails& committed_details = |
| 2402 *(Details<NavigationController::LoadCommittedDetails>(details).ptr()); | 2408 *(Details<NavigationController::LoadCommittedDetails>(details).ptr()); |
| 2403 ExpireInfoBars(committed_details); | 2409 ExpireInfoBars(committed_details); |
| 2404 break; | 2410 break; |
| 2405 } | 2411 } |
| 2406 | 2412 |
| 2407 default: | 2413 default: |
| 2408 NOTREACHED(); | 2414 NOTREACHED(); |
| 2409 } | 2415 } |
| 2410 } | 2416 } |
| OLD | NEW |