Skip to content

Commit

Permalink
Refactor automation messages.
Browse files Browse the repository at this point in the history
automation_messages used to live in chrome/test/automation, when it's needed by
browser and chrome_frame. When I started lifting code out of headers and into
implementation files, I was getting link errors and temporarily solved the
problem by compiling the cc files manually into libbrowser.a. Now this is part
of chrome/common/ which is included by all targets needed.

While doing this, discover that automation IPC redefines the ContextMenuParams struct. Rename it to MiniContextMenuParams.

BUG=51409
TEST=none

Review URL: http://codereview.chromium.org/4200007

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@64637 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
erg@google.com committed Nov 1, 2010
1 parent 1693996 commit 363680f
Show file tree
Hide file tree
Showing 71 changed files with 190 additions and 200 deletions.
2 changes: 1 addition & 1 deletion chrome/browser/automation/automation_provider.cc
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@
#include "chrome/browser/tab_contents/tab_contents_view.h"
#include "chrome/browser/translate/translate_infobar_delegate.h"
#include "chrome/common/automation_constants.h"
#include "chrome/common/automation_messages.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_switches.h"
Expand All @@ -95,7 +96,6 @@
#include "chrome/common/notification_service.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/url_constants.h"
#include "chrome/test/automation/automation_messages.h"
#include "chrome/test/automation/tab_proxy.h"
#include "net/proxy/proxy_service.h"
#include "net/proxy/proxy_config_service_fixed.h"
Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/automation/automation_provider.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
#include "chrome/browser/autofill/field_types.h"
#include "chrome/browser/cancelable_request.h"
#include "chrome/browser/tab_contents/navigation_entry.h"
#include "chrome/common/automation_constants.h"
#include "chrome/common/content_settings.h"
#include "chrome/common/notification_observer.h"
#include "chrome/test/automation/automation_constants.h"
#include "ipc/ipc_message.h"
#include "ipc/ipc_channel.h"
#if defined(OS_WIN)
Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/automation/automation_provider_gtk.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include "chrome/browser/gtk/browser_window_gtk.h"
#include "chrome/browser/gtk/gtk_util.h"
#include "chrome/browser/gtk/view_id_util.h"
#include "chrome/test/automation/automation_messages.h"
#include "chrome/common/automation_messages.h"
#include "gfx/point.h"
#include "gfx/rect.h"

Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/automation/automation_provider_json.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include "base/json/string_escape.h"
#include "chrome/browser/autocomplete/autocomplete_match.h"
#include "chrome/browser/automation/automation_provider.h"
#include "chrome/test/automation/automation_messages.h"
#include "chrome/common/automation_messages.h"

namespace {

Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/automation/automation_provider_mac.mm
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include "chrome/browser/cocoa/tab_window_controller.h"
#include "chrome/browser/view_ids.h"
#import "chrome/browser/cocoa/browser_window_controller.h"
#include "chrome/test/automation/automation_messages.h"
#include "chrome/common/automation_messages.h"
#include "gfx/point.h"
#include "gfx/rect.h"
#include "grit/generated_resources.h"
Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/automation/automation_provider_observers.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@
#include "chrome/browser/tab_contents/tab_contents.h"
#include "chrome/browser/translate/page_translated_details.h"
#include "chrome/browser/translate/translate_infobar_delegate.h"
#include "chrome/common/automation_constants.h"
#include "chrome/common/extensions/extension.h"
#include "chrome/common/notification_service.h"
#include "chrome/test/automation/automation_constants.h"
#include "gfx/rect.h"

#if defined(OS_CHROMEOS)
Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/automation/automation_provider_observers.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
#include "chrome/browser/password_manager/password_store.h"
#include "chrome/browser/search_engines/template_url_model_observer.h"
#include "chrome/browser/tabs/tab_strip_model.h"
#include "chrome/common/automation_messages.h"
#include "chrome/common/notification_observer.h"
#include "chrome/common/notification_registrar.h"
#include "chrome/common/notification_type.h"
#include "chrome/test/automation/automation_messages.h"

class AutocompleteEditModel;
class AutomationProvider;
Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/automation/automation_provider_win.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
#include "chrome/browser/renderer_host/render_view_host.h"
#include "chrome/browser/tab_contents/tab_contents.h"
#include "chrome/browser/views/bookmark_bar_view.h"
#include "chrome/common/automation_messages.h"
#include "chrome/common/page_zoom.h"
#include "chrome/test/automation/automation_messages.h"
#include "views/focus/accelerator_handler.h"
#include "views/widget/root_view.h"
#include "views/widget/widget_win.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
#include "chrome/browser/net/url_request_slow_download_job.h"
#include "chrome/browser/net/url_request_slow_http_job.h"
#include "chrome/browser/renderer_host/resource_message_filter.h"
#include "chrome/common/automation_messages.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/test/automation/automation_messages.h"
#include "googleurl/src/gurl.h"
#include "net/base/net_errors.h"
#include "net/url_request/url_request_filter.h"
Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/automation/automation_resource_tracker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

#include "chrome/browser/automation/automation_resource_tracker.h"

#include "chrome/common/automation_messages.h"
#include "chrome/common/notification_service.h"
#include "chrome/test/automation/automation_messages.h"

AutomationResourceTrackerImpl::AutomationResourceTrackerImpl(
IPC::Message::Sender* sender)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include "chrome/browser/automation/chrome_frame_automation_provider.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/profile_manager.h"
#include "chrome/test/automation/automation_messages.h"
#include "chrome/common/automation_messages.h"
#include "ipc/ipc_message.h"
#include "ipc/ipc_channel.h"

Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/automation/extension_port_container.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
#include "chrome/browser/profile.h"
#include "chrome/browser/renderer_host/render_process_host.h"
#include "chrome/browser/renderer_host/render_view_host.h"
#include "chrome/common/automation_messages.h"
#include "chrome/common/notification_service.h"
#include "chrome/common/render_messages.h"
#include "chrome/test/automation/automation_messages.h"

// TODO(siggi): Find a more structured way to read and write JSON messages.

Expand Down
20 changes: 10 additions & 10 deletions chrome/browser/automation/testing_automation_provider.cc
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
#include "chrome/browser/notifications/balloon_collection.h"
#include "chrome/browser/notifications/notification.h"
#include "chrome/browser/notifications/notification_ui_manager.h"
#include "chrome/test/automation/automation_messages.h"
#include "chrome/common/automation_messages.h"
#include "net/base/cookie_store.h"
#include "net/url_request/url_request_context.h"
#include "views/event.h"
Expand Down Expand Up @@ -1352,20 +1352,20 @@ void TestingAutomationProvider::GetSecurityState(int handle,
void TestingAutomationProvider::GetPageType(
int handle,
bool* success,
NavigationEntry::PageType* page_type) {
PageType* page_type) {
if (tab_tracker_->ContainsHandle(handle)) {
NavigationController* tab = tab_tracker_->GetResource(handle);
NavigationEntry* entry = tab->GetActiveEntry();
*page_type = entry->page_type();
*success = true;
// In order to return the proper result when an interstitial is shown and
// no navigation entry were created for it we need to ask the TabContents.
if (*page_type == NavigationEntry::NORMAL_PAGE &&
if (*page_type == NORMAL_PAGE &&
tab->tab_contents()->showing_interstitial_page())
*page_type = NavigationEntry::INTERSTITIAL_PAGE;
*page_type = INTERSTITIAL_PAGE;
} else {
*success = false;
*page_type = NavigationEntry::NORMAL_PAGE;
*page_type = NORMAL_PAGE;
}
}

Expand All @@ -1383,7 +1383,7 @@ void TestingAutomationProvider::ActionOnSSLBlockingPage(
if (tab_tracker_->ContainsHandle(handle)) {
NavigationController* tab = tab_tracker_->GetResource(handle);
NavigationEntry* entry = tab->GetActiveEntry();
if (entry->page_type() == NavigationEntry::INTERSTITIAL_PAGE) {
if (entry->page_type() == INTERSTITIAL_PAGE) {
TabContents* tab_contents = tab->tab_contents();
InterstitialPage* ssl_blocking_page =
InterstitialPage::GetInterstitialPage(tab_contents);
Expand Down Expand Up @@ -2458,10 +2458,10 @@ void TestingAutomationProvider::GetNavigationInfo(
return_value->Set("ssl", ssl);

// Page type.
std::map<NavigationEntry::PageType, std::string> pagetype_to_string;
pagetype_to_string[NavigationEntry::NORMAL_PAGE] = "NORMAL_PAGE";
pagetype_to_string[NavigationEntry::ERROR_PAGE] = "ERROR_PAGE";
pagetype_to_string[NavigationEntry::INTERSTITIAL_PAGE] = "INTERSTITIAL_PAGE";
std::map<PageType, std::string> pagetype_to_string;
pagetype_to_string[NORMAL_PAGE] = "NORMAL_PAGE";
pagetype_to_string[ERROR_PAGE] = "ERROR_PAGE";
pagetype_to_string[INTERSTITIAL_PAGE] = "INTERSTITIAL_PAGE";
return_value->SetString("page_type",
pagetype_to_string[nav_entry->page_type()]);

Expand Down
4 changes: 2 additions & 2 deletions chrome/browser/automation/testing_automation_provider.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include "chrome/browser/browser_list.h"
#include "chrome/browser/history/history.h"
#include "chrome/common/notification_registrar.h"
#include "chrome/common/page_type.h"

class DictionaryValue;
class TemplateURLModel;
Expand Down Expand Up @@ -197,8 +198,7 @@ class TestingAutomationProvider : public AutomationProvider,
int* insecure_content_status);

// Gets the page type for the tab associated to the specified |handle|.
void GetPageType(int handle, bool* success,
NavigationEntry::PageType* page_type);
void GetPageType(int handle, bool* success, PageType* page_type);

// Gets the duration in ms of the last event matching |event_name|.
// |duration_ms| is -1 if the event hasn't occurred yet.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include "chrome/browser/browser_window.h"
#include "chrome/browser/views/frame/browser_view.h"
#include "chrome/browser/views/toolbar_view.h"
#include "chrome/test/automation/automation_messages.h"
#include "chrome/common/automation_messages.h"
#include "gfx/point.h"
#include "views/controls/menu/menu_wrapper.h"
#include "views/view.h"
Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/automation/ui_controls_linux.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include "base/message_loop.h"
#include "chrome/browser/automation/ui_controls_internal.h"
#include "chrome/browser/gtk/gtk_util.h"
#include "chrome/test/automation/automation_constants.h"
#include "chrome/common/automation_constants.h"

#if defined(TOOLKIT_VIEWS)
#include "views/view.h"
Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/automation/url_request_automation_job.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include "chrome/browser/renderer_host/render_view_host.h"
#include "chrome/browser/renderer_host/resource_dispatcher_host.h"
#include "chrome/browser/renderer_host/resource_dispatcher_host_request_info.h"
#include "chrome/test/automation/automation_messages.h"
#include "chrome/common/automation_messages.h"
#include "net/base/cookie_monster.h"
#include "net/base/io_buffer.h"
#include "net/base/net_errors.h"
Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/extensions/extension_uitest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
#include "base/values.h"
#include "chrome/browser/automation/extension_automation_constants.h"
#include "chrome/browser/extensions/extension_tabs_module_constants.h"
#include "chrome/common/automation_messages.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/extensions/extension.h"
#include "chrome/test/automation/automation_messages.h"
#include "chrome/test/automation/automation_proxy_uitest.h"
#include "chrome/test/automation/tab_proxy.h"
#include "chrome/test/ui/ui_test.h"
Expand Down
4 changes: 2 additions & 2 deletions chrome/browser/external_tab_container_win.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@
#include "chrome/browser/tab_contents/tab_contents.h"
#include "chrome/browser/views/page_info_bubble_view.h"
#include "chrome/browser/views/tab_contents/tab_contents_container.h"
#include "chrome/common/automation_messages.h"
#include "chrome/common/bindings_policy.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/render_messages.h"
#include "chrome/common/render_messages_params.h"
#include "chrome/common/native_web_keyboard_event.h"
#include "chrome/common/notification_service.h"
#include "chrome/common/page_transition_types.h"
#include "chrome/test/automation/automation_messages.h"
#include "grit/generated_resources.h"
#include "grit/locale_settings.h"
#include "views/grid_layout.h"
Expand Down Expand Up @@ -618,7 +618,7 @@ bool ExternalTabContainer::HandleContextMenu(const ContextMenuParams& params) {
POINT screen_pt = { params.x, params.y };
MapWindowPoints(GetNativeView(), HWND_DESKTOP, &screen_pt, 1);

IPC::ContextMenuParams ipc_params;
IPC::MiniContextMenuParams ipc_params;
ipc_params.screen_x = screen_pt.x;
ipc_params.screen_y = screen_pt.y;
ipc_params.link_url = params.link_url;
Expand Down
7 changes: 3 additions & 4 deletions chrome/browser/ssl/ssl_browser_tests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class SSLUITest : public InProcessBrowserTest {
bool displayed_insecure_content) {
NavigationEntry* entry = tab->controller().GetActiveEntry();
ASSERT_TRUE(entry);
EXPECT_EQ(NavigationEntry::NORMAL_PAGE, entry->page_type());
EXPECT_EQ(NORMAL_PAGE, entry->page_type());
EXPECT_EQ(SECURITY_STYLE_AUTHENTICATED, entry->ssl().security_style());
EXPECT_EQ(0, entry->ssl().cert_status() & net::CERT_STATUS_ALL_ERRORS);
EXPECT_EQ(displayed_insecure_content,
Expand All @@ -49,7 +49,7 @@ class SSLUITest : public InProcessBrowserTest {
void CheckUnauthenticatedState(TabContents* tab) {
NavigationEntry* entry = tab->controller().GetActiveEntry();
ASSERT_TRUE(entry);
EXPECT_EQ(NavigationEntry::NORMAL_PAGE, entry->page_type());
EXPECT_EQ(NORMAL_PAGE, entry->page_type());
EXPECT_EQ(SECURITY_STYLE_UNAUTHENTICATED, entry->ssl().security_style());
EXPECT_EQ(0, entry->ssl().cert_status() & net::CERT_STATUS_ALL_ERRORS);
EXPECT_FALSE(entry->ssl().displayed_insecure_content());
Expand All @@ -62,8 +62,7 @@ class SSLUITest : public InProcessBrowserTest {
bool interstitial) {
NavigationEntry* entry = tab->controller().GetActiveEntry();
ASSERT_TRUE(entry);
EXPECT_EQ(interstitial ? NavigationEntry::INTERSTITIAL_PAGE :
NavigationEntry::NORMAL_PAGE,
EXPECT_EQ(interstitial ? INTERSTITIAL_PAGE : NORMAL_PAGE,
entry->page_type());
EXPECT_EQ(SECURITY_STYLE_AUTHENTICATION_BROKEN,
entry->ssl().security_style());
Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/tab_contents/interstitial_page.cc
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ void InterstitialPage::Show() {
NavigationEntry* entry = new NavigationEntry;
entry->set_url(url_);
entry->set_virtual_url(url_);
entry->set_page_type(NavigationEntry::INTERSTITIAL_PAGE);
entry->set_page_type(INTERSTITIAL_PAGE);

// Give sub-classes a chance to set some states on the navigation entry.
UpdateEntry(entry);
Expand Down
5 changes: 2 additions & 3 deletions chrome/browser/tab_contents/navigation_controller.cc
Original file line number Diff line number Diff line change
Expand Up @@ -718,7 +718,7 @@ void NavigationController::RendererDidNavigateToNewPage(
// Don't use the page type from the pending entry. Some interstitial page
// may have set the type to interstitial. Once we commit, however, the page
// type must always be normal.
new_entry->set_page_type(NavigationEntry::NORMAL_PAGE);
new_entry->set_page_type(NORMAL_PAGE);
} else {
new_entry = new NavigationEntry;
}
Expand Down Expand Up @@ -1200,8 +1200,7 @@ void NavigationController::InsertEntriesFrom(
size_t insert_index = 0;
for (int i = 0; i < max_index; i++) {
// When cloning a tab, copy all entries except interstitial pages
if (source.entries_[i].get()->page_type() !=
NavigationEntry::INTERSTITIAL_PAGE) {
if (source.entries_[i].get()->page_type() != INTERSTITIAL_PAGE) {
entries_.insert(entries_.begin() + insert_index++,
linked_ptr<NavigationEntry>(
new NavigationEntry(*source.entries_[i])));
Expand Down
8 changes: 3 additions & 5 deletions chrome/browser/tab_contents/navigation_controller_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1374,17 +1374,15 @@ TEST_F(NavigationControllerTest, Interstitial) {
// Now navigate somewhere with an interstitial.
const GURL url2("http://bar");
controller().LoadURL(url1, GURL(), PageTransition::TYPED);
controller().pending_entry()->set_page_type(
NavigationEntry::INTERSTITIAL_PAGE);
controller().pending_entry()->set_page_type(INTERSTITIAL_PAGE);

// At this point the interstitial will be displayed and the load will still
// be pending. If the user continues, the load will commit.
rvh()->SendNavigate(1, url2);

// The page should be a normal page again.
EXPECT_EQ(url2, controller().GetLastCommittedEntry()->url());
EXPECT_EQ(NavigationEntry::NORMAL_PAGE,
controller().GetLastCommittedEntry()->page_type());
EXPECT_EQ(NORMAL_PAGE, controller().GetLastCommittedEntry()->page_type());
}

TEST_F(NavigationControllerTest, RemoveEntry) {
Expand Down Expand Up @@ -1674,7 +1672,7 @@ TEST_F(NavigationControllerTest, CloneOmitsInterstitials) {

// Add an interstitial entry. Should be deleted with controller.
NavigationEntry* interstitial_entry = new NavigationEntry();
interstitial_entry->set_page_type(NavigationEntry::INTERSTITIAL_PAGE);
interstitial_entry->set_page_type(INTERSTITIAL_PAGE);
controller().AddTransientEntry(interstitial_entry);

scoped_ptr<TabContents> clone(controller().tab_contents()->Clone());
Expand Down
10 changes: 2 additions & 8 deletions chrome/browser/tab_contents/navigation_entry.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@

#include "base/basictypes.h"
#include "base/ref_counted.h"
#include "chrome/browser/tab_contents/security_style.h"
#include "chrome/common/page_type.h"
#include "chrome/common/page_transition_types.h"
#include "chrome/common/security_style.h"
#include "googleurl/src/gurl.h"
#include "third_party/skia/include/core/SkBitmap.h"

Expand Down Expand Up @@ -132,13 +133,6 @@ class NavigationEntry {
// Copy and assignment is explicitly allowed for this class.
};

// The type of the page an entry corresponds to. Used by tests.
enum PageType {
NORMAL_PAGE = 0,
ERROR_PAGE,
INTERSTITIAL_PAGE
};

// Favicon -------------------------------------------------------------------

// Collects the favicon related information for a NavigationEntry.
Expand Down
8 changes: 4 additions & 4 deletions chrome/browser/tab_contents/navigation_entry_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,10 @@ TEST_F(NavigationEntryTest, NavigationEntryAccessors) {
EXPECT_EQ(instance_, entry1_.get()->site_instance());

// Page type
EXPECT_EQ(NavigationEntry::NORMAL_PAGE, entry1_.get()->page_type());
EXPECT_EQ(NavigationEntry::NORMAL_PAGE, entry2_.get()->page_type());
entry2_.get()->set_page_type(NavigationEntry::INTERSTITIAL_PAGE);
EXPECT_EQ(NavigationEntry::INTERSTITIAL_PAGE, entry2_.get()->page_type());
EXPECT_EQ(NORMAL_PAGE, entry1_.get()->page_type());
EXPECT_EQ(NORMAL_PAGE, entry2_.get()->page_type());
entry2_.get()->set_page_type(INTERSTITIAL_PAGE);
EXPECT_EQ(INTERSTITIAL_PAGE, entry2_.get()->page_type());

// Referrer
EXPECT_EQ(GURL(), entry1_.get()->referrer());
Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/tab_contents/tab_contents.cc
Original file line number Diff line number Diff line change
Expand Up @@ -684,7 +684,7 @@ bool TabContents::ShouldDisplayURL() {
// Don't hide the url in view source mode and with interstitials.
NavigationEntry* entry = controller_.GetActiveEntry();
if (entry && (entry->IsViewSourceMode() ||
entry->page_type() == NavigationEntry::INTERSTITIAL_PAGE)) {
entry->page_type() == INTERSTITIAL_PAGE)) {
return true;
}

Expand Down
Loading

0 comments on commit 363680f

Please sign in to comment.