| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/ui/browser.h" | 5 #include "chrome/browser/ui/browser.h" |
| 6 | 6 |
| 7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
| 8 #include <shellapi.h> | 8 #include <shellapi.h> |
| 9 #include <windows.h> | 9 #include <windows.h> |
| 10 #endif // OS_WIN | 10 #endif // OS_WIN |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 #include "chrome/browser/sessions/tab_restore_service.h" | 68 #include "chrome/browser/sessions/tab_restore_service.h" |
| 69 #include "chrome/browser/sessions/tab_restore_service_factory.h" | 69 #include "chrome/browser/sessions/tab_restore_service_factory.h" |
| 70 #include "chrome/browser/sync/profile_sync_service.h" | 70 #include "chrome/browser/sync/profile_sync_service.h" |
| 71 #include "chrome/browser/sync/sync_ui_util.h" | 71 #include "chrome/browser/sync/sync_ui_util.h" |
| 72 #include "chrome/browser/tab_closeable_state_watcher.h" | 72 #include "chrome/browser/tab_closeable_state_watcher.h" |
| 73 #include "chrome/browser/tab_contents/background_contents.h" | 73 #include "chrome/browser/tab_contents/background_contents.h" |
| 74 #include "chrome/browser/tab_contents/simple_alert_infobar_delegate.h" | 74 #include "chrome/browser/tab_contents/simple_alert_infobar_delegate.h" |
| 75 #include "chrome/browser/tabs/tab_finder.h" | 75 #include "chrome/browser/tabs/tab_finder.h" |
| 76 #include "chrome/browser/tabs/tab_strip_model.h" | 76 #include "chrome/browser/tabs/tab_strip_model.h" |
| 77 #include "chrome/browser/ui/blocked_content/blocked_content_tab_helper.h" | 77 #include "chrome/browser/ui/blocked_content/blocked_content_tab_helper.h" |
| 78 #include "chrome/browser/ui/bookmarks/bookmarks_tab_helper.h" | 78 #include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h" |
| 79 #include "chrome/browser/ui/browser_list.h" | 79 #include "chrome/browser/ui/browser_list.h" |
| 80 #include "chrome/browser/ui/browser_tab_restore_service_delegate.h" | 80 #include "chrome/browser/ui/browser_tab_restore_service_delegate.h" |
| 81 #include "chrome/browser/ui/browser_window.h" | 81 #include "chrome/browser/ui/browser_window.h" |
| 82 #include "chrome/browser/ui/download/download_tab_helper.h" | 82 #include "chrome/browser/ui/download/download_tab_helper.h" |
| 83 #include "chrome/browser/ui/find_bar/find_bar.h" | 83 #include "chrome/browser/ui/find_bar/find_bar.h" |
| 84 #include "chrome/browser/ui/find_bar/find_bar_controller.h" | 84 #include "chrome/browser/ui/find_bar/find_bar_controller.h" |
| 85 #include "chrome/browser/ui/find_bar/find_tab_helper.h" | 85 #include "chrome/browser/ui/find_bar/find_tab_helper.h" |
| 86 #include "chrome/browser/ui/omnibox/location_bar.h" | 86 #include "chrome/browser/ui/omnibox/location_bar.h" |
| 87 #include "chrome/browser/ui/panels/panel.h" | 87 #include "chrome/browser/ui/panels/panel.h" |
| 88 #include "chrome/browser/ui/panels/panel_manager.h" | 88 #include "chrome/browser/ui/panels/panel_manager.h" |
| (...skipping 3382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3471 | 3471 |
| 3472 /////////////////////////////////////////////////////////////////////////////// | 3472 /////////////////////////////////////////////////////////////////////////////// |
| 3473 // Browser, BlockedContentTabHelperDelegate implementation: | 3473 // Browser, BlockedContentTabHelperDelegate implementation: |
| 3474 | 3474 |
| 3475 TabContentsWrapper* Browser::GetConstrainingContentsWrapper( | 3475 TabContentsWrapper* Browser::GetConstrainingContentsWrapper( |
| 3476 TabContentsWrapper* source) { | 3476 TabContentsWrapper* source) { |
| 3477 return source; | 3477 return source; |
| 3478 } | 3478 } |
| 3479 | 3479 |
| 3480 /////////////////////////////////////////////////////////////////////////////// | 3480 /////////////////////////////////////////////////////////////////////////////// |
| 3481 // Browser, BookmarksTabHelperDelegate implementation: | 3481 // Browser, BookmarkTabHelperDelegate implementation: |
| 3482 | 3482 |
| 3483 void Browser::URLStarredChanged(TabContentsWrapper* source, bool starred) { | 3483 void Browser::URLStarredChanged(TabContentsWrapper* source, bool starred) { |
| 3484 if (source == GetSelectedTabContentsWrapper()) | 3484 if (source == GetSelectedTabContentsWrapper()) |
| 3485 window_->SetStarredState(starred); | 3485 window_->SetStarredState(starred); |
| 3486 } | 3486 } |
| 3487 | 3487 |
| 3488 /////////////////////////////////////////////////////////////////////////////// | 3488 /////////////////////////////////////////////////////////////////////////////// |
| 3489 // Browser, SelectFileDialog::Listener implementation: | 3489 // Browser, SelectFileDialog::Listener implementation: |
| 3490 | 3490 |
| 3491 void Browser::FileSelected(const FilePath& path, int index, void* params) { | 3491 void Browser::FileSelected(const FilePath& path, int index, void* params) { |
| (...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3878 CanReloadContents(current_tab)); | 3878 CanReloadContents(current_tab)); |
| 3879 command_updater_.UpdateCommandEnabled(IDC_RELOAD_IGNORING_CACHE, | 3879 command_updater_.UpdateCommandEnabled(IDC_RELOAD_IGNORING_CACHE, |
| 3880 CanReloadContents(current_tab)); | 3880 CanReloadContents(current_tab)); |
| 3881 | 3881 |
| 3882 // Window management commands | 3882 // Window management commands |
| 3883 command_updater_.UpdateCommandEnabled(IDC_DUPLICATE_TAB, | 3883 command_updater_.UpdateCommandEnabled(IDC_DUPLICATE_TAB, |
| 3884 !is_app() && CanDuplicateContentsAt(active_index())); | 3884 !is_app() && CanDuplicateContentsAt(active_index())); |
| 3885 | 3885 |
| 3886 // Page-related commands | 3886 // Page-related commands |
| 3887 window_->SetStarredState( | 3887 window_->SetStarredState( |
| 3888 current_tab_wrapper->bookmarks_tab_helper()->is_starred()); | 3888 current_tab_wrapper->bookmark_tab_helper()->is_starred()); |
| 3889 command_updater_.UpdateCommandEnabled(IDC_VIEW_SOURCE, | 3889 command_updater_.UpdateCommandEnabled(IDC_VIEW_SOURCE, |
| 3890 current_tab->controller().CanViewSource()); | 3890 current_tab->controller().CanViewSource()); |
| 3891 command_updater_.UpdateCommandEnabled(IDC_EMAIL_PAGE_LOCATION, | 3891 command_updater_.UpdateCommandEnabled(IDC_EMAIL_PAGE_LOCATION, |
| 3892 current_tab->ShouldDisplayURL() && current_tab->GetURL().is_valid()); | 3892 current_tab->ShouldDisplayURL() && current_tab->GetURL().is_valid()); |
| 3893 | 3893 |
| 3894 // Changing the encoding is not possible on Chrome-internal webpages. | 3894 // Changing the encoding is not possible on Chrome-internal webpages. |
| 3895 // Instead of using GetURL here, we use url() (which is the "real" url of the | 3895 // Instead of using GetURL here, we use url() (which is the "real" url of the |
| 3896 // page) from the NavigationEntry because its reflects their origin rather | 3896 // page) from the NavigationEntry because its reflects their origin rather |
| 3897 // than the display one (returned by GetURL) which may be different (like | 3897 // than the display one (returned by GetURL) which may be different (like |
| 3898 // having "view-source:" on the front). | 3898 // having "view-source:" on the front). |
| (...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4377 return browser; | 4377 return browser; |
| 4378 } | 4378 } |
| 4379 | 4379 |
| 4380 void Browser::SetAsDelegate(TabContentsWrapper* tab, Browser* delegate) { | 4380 void Browser::SetAsDelegate(TabContentsWrapper* tab, Browser* delegate) { |
| 4381 // TabContents... | 4381 // TabContents... |
| 4382 tab->tab_contents()->set_delegate(delegate); | 4382 tab->tab_contents()->set_delegate(delegate); |
| 4383 tab->set_delegate(delegate); | 4383 tab->set_delegate(delegate); |
| 4384 | 4384 |
| 4385 // ...and all the helpers. | 4385 // ...and all the helpers. |
| 4386 tab->blocked_content_tab_helper()->set_delegate(delegate); | 4386 tab->blocked_content_tab_helper()->set_delegate(delegate); |
| 4387 tab->bookmarks_tab_helper()->set_delegate(delegate); | 4387 tab->bookmark_tab_helper()->set_delegate(delegate); |
| 4388 tab->search_engine_tab_helper()->set_delegate(delegate); | 4388 tab->search_engine_tab_helper()->set_delegate(delegate); |
| 4389 } | 4389 } |
| 4390 | 4390 |
| 4391 void Browser::FindInPage(bool find_next, bool forward_direction) { | 4391 void Browser::FindInPage(bool find_next, bool forward_direction) { |
| 4392 ShowFindBar(); | 4392 ShowFindBar(); |
| 4393 if (find_next) { | 4393 if (find_next) { |
| 4394 string16 find_text; | 4394 string16 find_text; |
| 4395 #if defined(OS_MACOSX) | 4395 #if defined(OS_MACOSX) |
| 4396 // We always want to search for the contents of the find pasteboard on OS X. | 4396 // We always want to search for the contents of the find pasteboard on OS X. |
| 4397 find_text = GetFindPboardText(); | 4397 find_text = GetFindPboardText(); |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4601 TabContents* current_tab = GetSelectedTabContents(); | 4601 TabContents* current_tab = GetSelectedTabContents(); |
| 4602 if (current_tab) { | 4602 if (current_tab) { |
| 4603 content_restrictions = current_tab->content_restrictions(); | 4603 content_restrictions = current_tab->content_restrictions(); |
| 4604 NavigationEntry* active_entry = current_tab->controller().GetActiveEntry(); | 4604 NavigationEntry* active_entry = current_tab->controller().GetActiveEntry(); |
| 4605 // See comment in UpdateCommandsForTabState about why we call url(). | 4605 // See comment in UpdateCommandsForTabState about why we call url(). |
| 4606 if (!SavePackage::IsSavableURL(active_entry ? active_entry->url() : GURL())) | 4606 if (!SavePackage::IsSavableURL(active_entry ? active_entry->url() : GURL())) |
| 4607 content_restrictions |= CONTENT_RESTRICTION_SAVE; | 4607 content_restrictions |= CONTENT_RESTRICTION_SAVE; |
| 4608 } | 4608 } |
| 4609 return content_restrictions; | 4609 return content_restrictions; |
| 4610 } | 4610 } |
| OLD | NEW |