Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(312)

Side by Side Diff: chrome/browser/tab_contents/tab_contents.cc

Issue 306044: Refactor implementation of BrowserActions, and add support for (Closed)
Patch Set: Make it work on linux too Created 11 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
11 #include "base/string16.h" 11 #include "base/string16.h"
12 #include "base/string_util.h" 12 #include "base/string_util.h"
13 #include "base/time.h" 13 #include "base/time.h"
14 #include "chrome/browser/blocked_popup_container.h" 14 #include "chrome/browser/blocked_popup_container.h"
15 #include "chrome/browser/bookmarks/bookmark_model.h" 15 #include "chrome/browser/bookmarks/bookmark_model.h"
16 #include "chrome/browser/browser_process.h" 16 #include "chrome/browser/browser_process.h"
17 #include "chrome/browser/cert_store.h" 17 #include "chrome/browser/cert_store.h"
18 #include "chrome/browser/character_encoding.h" 18 #include "chrome/browser/character_encoding.h"
19 #include "chrome/browser/debugger/devtools_manager.h" 19 #include "chrome/browser/debugger/devtools_manager.h"
20 #include "chrome/browser/dom_operation_notification_details.h" 20 #include "chrome/browser/dom_operation_notification_details.h"
21 #include "chrome/browser/dom_ui/dom_ui.h" 21 #include "chrome/browser/dom_ui/dom_ui.h"
22 #include "chrome/browser/dom_ui/dom_ui_factory.h" 22 #include "chrome/browser/dom_ui/dom_ui_factory.h"
23 #include "chrome/browser/download/download_item_model.h" 23 #include "chrome/browser/download/download_item_model.h"
24 #include "chrome/browser/download/download_manager.h" 24 #include "chrome/browser/download/download_manager.h"
25 #include "chrome/browser/download/download_request_manager.h" 25 #include "chrome/browser/download/download_request_manager.h"
26 #include "chrome/browser/external_protocol_handler.h" 26 #include "chrome/browser/external_protocol_handler.h"
27 #include "chrome/browser/extensions/extensions_service.h"
27 #include "chrome/browser/favicon_service.h" 28 #include "chrome/browser/favicon_service.h"
28 #include "chrome/browser/form_field_history_manager.h" 29 #include "chrome/browser/form_field_history_manager.h"
29 #include "chrome/browser/gears_integration.h" 30 #include "chrome/browser/gears_integration.h"
30 #include "chrome/browser/google_util.h" 31 #include "chrome/browser/google_util.h"
31 #include "chrome/browser/hung_renderer_dialog.h" 32 #include "chrome/browser/hung_renderer_dialog.h"
32 #include "chrome/browser/jsmessage_box_handler.h" 33 #include "chrome/browser/jsmessage_box_handler.h"
33 #include "chrome/browser/load_from_memory_cache_details.h" 34 #include "chrome/browser/load_from_memory_cache_details.h"
34 #include "chrome/browser/load_notification_details.h" 35 #include "chrome/browser/load_notification_details.h"
35 #include "chrome/browser/metrics/metric_event_duration_details.h" 36 #include "chrome/browser/metrics/metric_event_duration_details.h"
36 #include "chrome/browser/modal_html_dialog_delegate.h" 37 #include "chrome/browser/modal_html_dialog_delegate.h"
(...skipping 1366 matching lines...) Expand 10 before | Expand all | Expand 10 after
1403 // the commit. 1404 // the commit.
1404 GenerateKeywordIfNecessary(params); 1405 GenerateKeywordIfNecessary(params);
1405 1406
1406 // Allow the new page to set the title again. 1407 // Allow the new page to set the title again.
1407 received_page_title_ = false; 1408 received_page_title_ = false;
1408 1409
1409 // Get the favicon, either from history or request it from the net. 1410 // Get the favicon, either from history or request it from the net.
1410 fav_icon_helper_.FetchFavIcon(details.entry->url()); 1411 fav_icon_helper_.FetchFavIcon(details.entry->url());
1411 1412
1412 // Disable all page actions, unless this is an in-page navigation. 1413 // Disable all page actions, unless this is an in-page navigation.
1413 if (!page_actions_.empty()) { 1414 url_canon::Replacements<char> replacements;
1414 url_canon::Replacements<char> replacements; 1415 replacements.ClearRef();
1415 replacements.ClearRef(); 1416 if (params.url.ReplaceComponents(replacements) !=
1416 if (params.url.ReplaceComponents(replacements) != 1417 params.referrer.ReplaceComponents(replacements)) {
1417 params.referrer.ReplaceComponents(replacements)) { 1418 if (!page_actions_.empty())
1418 page_actions_.clear(); 1419 page_actions_.clear();
1420
1421 ExtensionsService* service = profile()->GetExtensionsService();
1422 if (service) {
1423 for (size_t i = 0; i < service->extensions()->size(); ++i) {
1424 ExtensionAction2* action =
1425 service->extensions()->at(i)->browser_action();
1426 if (!action)
1427 continue;
1428
1429 action->ClearAllValuesForTab(controller().session_id().id());
1430 NotificationService::current()->Notify(
1431 NotificationType::EXTENSION_BROWSER_ACTION_UPDATED,
1432 Source<ExtensionAction2>(action),
1433 NotificationService::NoDetails());
1434 }
1419 } 1435 }
1420 } 1436 }
1421 1437
1422 // Close constrained popups if necessary. 1438 // Close constrained popups if necessary.
1423 MaybeCloseChildWindows(details.previous_url, details.entry->url()); 1439 MaybeCloseChildWindows(details.previous_url, details.entry->url());
1424 1440
1425 // Update the starred state. 1441 // Update the starred state.
1426 UpdateStarredStateForCurrentURL(); 1442 UpdateStarredStateForCurrentURL();
1427 } 1443 }
1428 1444
(...skipping 1201 matching lines...) Expand 10 before | Expand all | Expand 10 after
2630 #endif 2646 #endif
2631 2647
2632 default: 2648 default:
2633 NOTREACHED(); 2649 NOTREACHED();
2634 } 2650 }
2635 } 2651 }
2636 2652
2637 void TabContents::set_encoding(const std::string& encoding) { 2653 void TabContents::set_encoding(const std::string& encoding) {
2638 encoding_ = CharacterEncoding::GetCanonicalEncodingNameByAliasName(encoding); 2654 encoding_ = CharacterEncoding::GetCanonicalEncodingNameByAliasName(encoding);
2639 } 2655 }
OLDNEW
« no previous file with comments | « chrome/browser/gtk/location_bar_view_gtk.cc ('k') | chrome/browser/views/browser_actions_container.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698